2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.replicate.netty;
10 import io.netty.buffer.ByteBuf;
11 import io.netty.buffer.Unpooled;
12 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 final class Constants {
17 * Subscribe request message. This is the only valid initial message in the sink->source direction. Its payload is
18 * composed of a binary normalized node stream. The stream must contain a {@link LogicalDatastoreType} serialized
19 * via {@link LogicalDatastoreType#writeTo(java.io.DataOutput)} followed by a single {@link YangInstanceIdentifier}.
21 static final byte MSG_SUBSCRIBE_REQ = 1;
23 * Initial data indicating non-presence of the subscribed path.
25 static final byte MSG_EMPTY_DATA = 2;
27 * A chunk of the DataTreeCandidate serialization stream. May be followed by another chunk or
28 * {@link #MSG_DTC_APPLY}.
30 static final byte MSG_DTC_CHUNK = 3;
32 * End-of-DataTreeCandidate serialization stream. The payload is empty.
34 static final byte MSG_DTC_APPLY = 4;
37 * Length of the length field in each transmitted frame.
39 static final int LENGTH_FIELD_LENGTH = 4;
41 * Maximum frame size allowed by encoding, 1MiB.
43 static final int LENGTH_FIELD_MAX = 1024 * 1024;
45 static final ByteBuf EMPTY_DATA = Unpooled.unreleasableBuffer(
46 Unpooled.wrappedBuffer(new byte[] { MSG_EMPTY_DATA }));
48 static final ByteBuf DTC_APPLY = Unpooled.unreleasableBuffer(Unpooled.wrappedBuffer(new byte[] { MSG_DTC_APPLY }));