proto

package
v0.0.0-...-9750751 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package proto implements Juno binary message protocol.

Juno Message

A Juno message looks like

+------------------------+----------------------------------------------------+
| 12-byte message header | message body depending message type(can be absent) |
+------------------------+----------------------------------------------------+

Message header

        | 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7|
   byte |                      0|                      1|                      2|                      3|
  ------+-----------------------+-----------------------+-----------------------+-----------------------+
      0 | magic number                                  | protocol version      | message type flag     |
        |                                               |                       +-----------------+-----+
        |                                               |                       | type            | RQ  |
  ------+-----------------------------------------------+-----------------------+-----------------+-----+
      4 | message size                                                                                  |
  ------+-----------------------------------------------------------------------------------------------+
      8 | opaque                                                                                        |
  ------+-----------------------------------------------------------------------------------------------+

  magic number:
    0x5050
  protocol version:
    1

  message type and flag:
    type:
	  0: operational message
	  1: admin message
	  2: cluster control message
    RQ:
      0 response
      1 two way request
      3 one way request

Operational Message

An operational message looks like

+------------------------+----------------------------------------------------------------------+
| 12-byte message header |                       message body                                   |
|                        +----------------------------+-----------------------------------------+
|                        | operational message header | operational message body(can be absent) |
+------------------------+----------------------------+-----------------------------------------+

Details

  ==========================
  operational message header
  ==========================

  operational request header

        |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
   byte |              0|              1|              2|              3|
  ------+---------------+---------------+---------------+---------------+
      0 | opcode        |flag           | shard Id                      |
        |               +-+-------------+                               |
        |               |R|             |                               |
  ------+---------------+-+-------------+-------------------------------+

  operational response header
        |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
   byte |              0|              1|              2|              3|
  ------+---------------+---------------+---------------+---------------+
      0 | opcode        |flag           | reserved      | status        |
        |               +-+-------------+               |               |
        |               |R|             |               |               |
  ------+---------------+-+-------------+---------------+---------------+

  opcode:
    0x00	Nop
    0x01	Create
    0x02	Get
    0x03	Update
    0x04	Set
    0x05	Destroy
    0x81	PrepareCreate
    0x82	Read
    0x83	PrepareUpdate
    0x84	PrepareSet
    0x85	PrepareDelete
    0x86	Delete
    0xC1	Commit
    0xC2	Abort (Rollback)
    0xC3	Repair
    0xC4	MarkDelete
    0xE1	Clone
    0xFE	MockSetParam
    oxFF	MockReSet

  RQ:
	  0 response
	  1 two way request
	  3 one way request
  R:
	  1 if it is for replication
  shard Id
	  only meaning for request to SS
  Status:
	  1 byte, only meaningful for response
  ========================
  Operational message body
  ========================

  An operational message body contains zero or multiple components

  =============
  * Component *
  =============
  +-----------------------+-------------------------+-----------------+----------------+--------------+
  | 4-byte component size | 1 byte component Tag/ID | component header| component body | padding to 8 |
  +-----------------------+-------------------------+-----------------+----------------+--------------+
  In Juno protocol version 1, two types of components are defined
    1. payload component
    2. meta data component

  =====================================
  ** Payload (or KeyValue) Component **
  =====================================

  Tag/ID: 0x01

  A fixed length header followed by the component body defining namespace, key, and value

  payload component header

  ------+------------------+--------
        | namespace length | 1 byte
  ------+------------------+--------
        | key length       | 2 bytes
  ------+------------------+--------
        | value length     | 4 bytes
  ------+------------------+--------

  payload component body
  +---------+-----+-------+-------------------------+
  |namespace| key | value | padding to align 8-byte |
  +---------+-----+-------+-------------------------+

  payload value field

  +---------------------+--------------+
  | 1 byte payload type | Payload data |
  +---------------------+--------------+

  payload Type
    0: payload data is the actual value passed from client user
    1: payload data is encrypted by Juno client library, details not specified
    2: payload data is encrypted by Juno proxy with AES-GCM. encryption key length is 256 bits

  payload data for payload type 2
  +--------------------------------+----------------+----------------+
  | 4 bytes encryption key version | 12 bytes nonce | encrypted data |
  +--------------------------------+----------------+----------------+

  ====================
  ** Meta Component **
  ====================

  Tag/ID: 0x02

  A variable length header followed by a set of meta data fields

  meta component header

      | 0| 1| 2| 3| 4| 5| 6| 7|
  ----+-----------------------+---------
      | number of fields      | 1 byte
  ----+--------------+--------+---------
      | field tag    |sizeType| 1 byte
  ----+--------------+--------+---------
      | ...                   |
  ----+-----------------------+---------
      | padding to 4          |
  ----+-----------------------+---------

  sizeType:
  0		variable length field, for that case,
		the first 1 byte of the field MUST be
		the size of the field(padding to 4 byte).
		The max is 255.
  n		Fixed length: 2 ^ (n+1)  bytes

  meta component body
  ----+-----------------------+---------
      | field data            | defined by Field tag
  ----+-----------------------+---------
      | ...                   |
  ----+-----------------------+---------
      | padding to 8          |
  ----+-----------------------+---------

	  ==============================
	  *** Predefined Field Types ***
	  ==============================

	  Tag/ID |  Field     | SizeType
	  -------+--------------------------------------+------
	    0x01 | TimeToLive                           | 0x01
	    0x02 | Version                              | 0x01
	    0x03 | Creation Time                        | 0x01
	    0x04 | Expiration Time                      | 0x01
	    0x05 | RequestID/UUID                       | 0x03
	    0x06 | Source Info                          | 0
	    0x07 | Last Modification time (nano second) | 0x02
	    0x08 | Originator RequestID/UUID            | 0x03
	    0x09 | Correlation ID                       | 0
	    0x0a | RequestHandlingTime                  | 0x01
		0x0b | UDF Name			                    | 0
	  -------+--------------------------------------+------

	  Tag/ID: 0x06
	  +-----------------------------------------------------------------------------------------------+
	  | 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7|
	  |                      0|                      1|                      2|                      3|
	  +-----------+-----------+--------------------+--+-----------------------+-----------------------+
	  | size (include padding)| app name length    | T| Port                                          |
	  +-----------------------+--------------------+--+-----------------------------------------------+
	  | IPv4 address if T is 0 or IPv6 address if T is 1                                              |
	  +-----------------------------------------------------------------------------------------------+
	  | application name, padding to 4-byte aligned                                                   |
	  +-----------------------------------------------------------------------------------------------+

	  Tag/ID: 0x09; 0x0b
	  +----+-------------------------------------------
	  |  0 | field size (including padding)
	  +----+-------------------------------------------
	  |  1 | octet sequence length
	  +----+-------------------------------------------
	  |    | octet sequence, padding to 4-byte aligned
	  +----+-------------------------------------------

Index

Constants

View Source
const (
	OpCodeNop         = OpCode(0)
	OpCodeCreate      = OpCode(1)
	OpCodeGet         = OpCode(2)
	OpCodeUpdate      = OpCode(3)
	OpCodeSet         = OpCode(4)
	OpCodeDestroy     = OpCode(5)
	OpCodeUDFGet      = OpCode(6)
	OpCodeUDFSet      = OpCode(7)
	OpCodeLastProxyOp = OpCode(8) // add proxy op before this

	OpCodePrepareCreate = OpCode(0x81)
	OpCodeRead          = OpCode(0x82)
	OpCodePrepareUpdate = OpCode(0x83)
	OpCodePrepareSet    = OpCode(0x84)
	OpCodePrepareDelete = OpCode(0x85)
	OpCodeDelete        = OpCode(0x86)

	OpCodeCommit     = OpCode(0xC1)
	OpCodeAbort      = OpCode(0xC2)
	OpCodeRepair     = OpCode(0xC3)
	OpCodeMarkDelete = OpCode(0xC4)

	OpCodeClone        = OpCode(0xE1)
	OpCodeVerHandshake = OpCode(0xE2)

	OpCodeMockGetExtendTTL = OpCode(0xFD)
	OpCodeMockSetParam     = OpCode(0xFE)
	OpCodeMockReSet        = OpCode(0xFF)
)
View Source
const (
	OpStatusNoError            = OpStatus(0)
	OpStatusBadMsg             = OpStatus(1)
	OpStatusServiceDenied      = OpStatus(2)
	OpStatusBadParam           = OpStatus(7)
	OpStatusNoKey              = OpStatus(3)
	OpStatusDupKey             = OpStatus(4)
	OpStatusRecordLocked       = OpStatus(8)
	OpStatusVersionConflict    = OpStatus(19)
	OpStatusNoStorageServer    = OpStatus(12)
	OpStatusInserting          = OpStatus(15)
	OpStatusAlreadyFulfilled   = OpStatus(17)
	OpStatusNoUncommitted      = OpStatus(10)
	OpStatusBusy               = OpStatus(14)
	OpStatusSSError            = OpStatus(21)
	OpStatusSSOutofResource    = OpStatus(22)
	OpStatusSSReadTTLExtendErr = OpStatus(23)
	OpStatusKeyMarkedDelete    = OpStatus(27)
	OpStatusCommitFailure      = OpStatus(25)
	OpStatusInconsistent       = OpStatus(26)
	OpStatusReqProcTimeout     = OpStatus(24)
	OpStatusNotSupported       = OpStatus(28)
)
View Source
const (
	PayloadTypeClear = iota
	PayloadTypeEncryptedByClient
	PayloadTypeEncryptedByProxy
	PayloadTypecompressedByClient
)
View Source
const (
	StatusOk          = 0
	StatusNoConn      = 1
	StatusCommErr     = 2
	StatusTimeout     = 3
	StatusBadRequest  = 4
	StatusBadResponse = 5
	StatusNoCapacity  = 6
	StatusSSBusy      = 7
	StatusRBCleanup   = 8
	StatusRBExpire    = 9
)
View Source
const (
	OpStatusInternal = OpStatus(255)
)
View Source
const (
	SnappyCompression string = "Snappy"
)

Variables

View Source
var (
	ErrFailToGetEncryptionKey = errors.New("fail to get encryption key")
	ErrFailTogetKeyStore      = errors.New("fail to get key store")
)
View Source
var (
	ErrNotSupportedMessage   = &ProtocolError{"Message type not supported"}
	ErrInvalidBufferSize     = &ProtocolError{"Buffer size"}
	ErrInvalidMessageHeader  = &ProtocolError{"Invalid Message Header"}
	ErrInvalidMessageSize    = &ProtocolError{"Invalid Message Size"}
	ErrInvalidMessage        = &ProtocolError{"Invalid Message"}
	ErrInvalidComponentTag   = &ProtocolError{"Invalid Component Tag"}
	ErrInvalidMetaCompHeader = &ProtocolError{"Invalid Meta Component Header"}
	ErrBufferTooShort        = &ProtocolError{"Input buffer too short"}
	ErrInvalidRequestID      = &ProtocolError{"Invalid request ID"}
	ErrInvalidSourceInfo     = &ProtocolError{"Invalid source info"}
	ErrInvalidByteSequence   = &ProtocolError{"Invalid byte sequence"}
	ErrInvalidIPAddress      = &ProtocolError{"Invalid IP Address"}
	ErrInvalidMetaFieldSize  = &ProtocolError{"Invalid Meta Field Size"}
)
View Source
var (
	ErrClientKeyStoreNotAvailable = fmt.Errorf("client encryption key store not avaliable")
	ErrServerKeyStoreNotAvailable = fmt.Errorf("server encryption key store not avaliable")
	ErrUnsupportedPayloadType     = fmt.Errorf("unsupported payload type")
	ErrPayloadNoEncryptionHeader  = fmt.Errorf("no encryption header")
	ErrUnsupportedCompressionType = fmt.Errorf("unsupported compression type")
)
View Source
var (
	EncByteOrder = binary.BigEndian
)
View Source
var (
	JunoMagic [2]byte = [2]byte{0x50, 0x50}
)
View Source
var NilRequestId = RequestId{}

Functions

func Equal

func Equal(rid1 RequestId, rid2 RequestId) bool

func GetOpCodeAndOpStatus

func GetOpCodeAndOpStatus(wmsg *RawMessage) (opCode OpCode, opStatus OpStatus, err error)

func InitializeKeyStore

func InitializeKeyStore(pType PayloadType, ks IEncryptionKeyStore)

func RequestIdTextFromBytes

func RequestIdTextFromBytes(b []byte) string

func SetOpCode

func SetOpCode(wmsg *RawMessage, opcode OpCode) (err error)

func SetOpStatus

func SetOpStatus(wmsg *RawMessage, st OpStatus) (err error)

func SetRequestHandlingTime

func SetRequestHandlingTime(raw *RawMessage, t uint32)

Set RequestHandlingTime in meta component First meta field should be RequestHandlingTime if any.

func SetShardId

func SetShardId(wmsg *RawMessage, vid uint16) (err error)

func StatusText

func StatusText(code int) string

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (dec *Decoder) Decode(op *OperationalMessage) error

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (enc *Encoder) Encode(msg IMessage) (err error)

type IEncryptionKeyStore

type IEncryptionKeyStore interface {
	GetEncryptionKey() (key []byte, version uint32, err error)
	GetDecryptionKey(version uint32) (key []byte, err error)
	NumKeys() (numKeys int)
}

type IMessage

type IMessage interface {
}

type IRequestId

type IRequestId interface {
	Bytes() []byte
	String() string
	PrettyPrint(w io.Writer)
}

type OpCode

type OpCode uint8

func GetOpCode

func GetOpCode(wmsg *RawMessage) (opCode OpCode, err error)

func GetOpCodeAndFlag

func GetOpCodeAndFlag(wmsg *RawMessage) (opCode OpCode, flag uint8, err error)

func (OpCode) IsForStorage

func (op OpCode) IsForStorage() bool

func (OpCode) ShortNameString

func (op OpCode) ShortNameString() string

func (OpCode) String

func (op OpCode) String() string

type OpStatus

type OpStatus uint8

func GetOpStatus

func GetOpStatus(wmsg *RawMessage) (opStatus OpStatus, err error)

func (OpStatus) ShortNameString

func (s OpStatus) ShortNameString() string

func (OpStatus) String

func (s OpStatus) String() string

type OperationalMessage

type OperationalMessage struct {
	// contains filtered or unexported fields
}

func (*OperationalMessage) ClearPayload

func (m *OperationalMessage) ClearPayload()

func (*OperationalMessage) CreateResponse

func (op *OperationalMessage) CreateResponse() (resp *OperationalMessage)

func (*OperationalMessage) Decode

func (op *OperationalMessage) Decode(wmsg *RawMessage) error

func (*OperationalMessage) Encode

func (op *OperationalMessage) Encode(wMsg *RawMessage) (err error)

func (*OperationalMessage) GetAppName

func (m *OperationalMessage) GetAppName() []byte

func (*OperationalMessage) GetCorrelationID

func (m *OperationalMessage) GetCorrelationID() []byte

func (*OperationalMessage) GetCreationTime

func (m *OperationalMessage) GetCreationTime() uint32

func (*OperationalMessage) GetExpirationTime

func (m *OperationalMessage) GetExpirationTime() uint32

func (*OperationalMessage) GetFlags

func (m *OperationalMessage) GetFlags() opMsgFlagT

func (*OperationalMessage) GetKey

func (m *OperationalMessage) GetKey() []byte

func (*OperationalMessage) GetKeyHexString

func (m *OperationalMessage) GetKeyHexString() string

func (*OperationalMessage) GetLastModificationTime

func (m *OperationalMessage) GetLastModificationTime() uint64

func (*OperationalMessage) GetNamespace

func (m *OperationalMessage) GetNamespace() []byte

func (*OperationalMessage) GetOpCode

func (m *OperationalMessage) GetOpCode() OpCode

func (*OperationalMessage) GetOpCodeText

func (m *OperationalMessage) GetOpCodeText() string

func (*OperationalMessage) GetOpStatus

func (m *OperationalMessage) GetOpStatus() OpStatus

func (*OperationalMessage) GetOpStatusText

func (m *OperationalMessage) GetOpStatusText() string

func (*OperationalMessage) GetOpaque

func (m *OperationalMessage) GetOpaque() uint32

func (*OperationalMessage) GetOriginatorRequestID

func (m *OperationalMessage) GetOriginatorRequestID() RequestId

func (*OperationalMessage) GetOriginatorRequestIDString

func (m *OperationalMessage) GetOriginatorRequestIDString() string

func (*OperationalMessage) GetPayload

func (m *OperationalMessage) GetPayload() *Payload

func (*OperationalMessage) GetPayloadLength

func (m *OperationalMessage) GetPayloadLength() uint32

func (*OperationalMessage) GetPayloadValueLength

func (m *OperationalMessage) GetPayloadValueLength() uint32

func (*OperationalMessage) GetRequestHandlingTime

func (m *OperationalMessage) GetRequestHandlingTime() uint32

func (*OperationalMessage) GetRequestID

func (m *OperationalMessage) GetRequestID() RequestId

func (*OperationalMessage) GetRequestIDString

func (m *OperationalMessage) GetRequestIDString() string

func (*OperationalMessage) GetShardId

func (m *OperationalMessage) GetShardId() uint16

func (*OperationalMessage) GetSrcIP

func (m *OperationalMessage) GetSrcIP() net.IP

func (*OperationalMessage) GetSrcPort

func (m *OperationalMessage) GetSrcPort() uint16

func (*OperationalMessage) GetTimeToLive

func (m *OperationalMessage) GetTimeToLive() uint32

func (*OperationalMessage) GetUDFName

func (m *OperationalMessage) GetUDFName() []byte

func (*OperationalMessage) GetVersion

func (m *OperationalMessage) GetVersion() uint32

func (*OperationalMessage) IsForDeleteReplication

func (m *OperationalMessage) IsForDeleteReplication() bool

For namespace migration

func (*OperationalMessage) IsForReplication

func (m *OperationalMessage) IsForReplication() bool

func (*OperationalMessage) IsOriginatorSet

func (m *OperationalMessage) IsOriginatorSet() bool

func (*OperationalMessage) IsRequest

func (m *OperationalMessage) IsRequest() bool

func (*OperationalMessage) IsRequestIDSet

func (m *OperationalMessage) IsRequestIDSet() bool

func (*OperationalMessage) IsResponse

func (m *OperationalMessage) IsResponse() bool

func (*OperationalMessage) IsUDFNameSet

func (m *OperationalMessage) IsUDFNameSet() bool

func (*OperationalMessage) PrettyPrint

func (m *OperationalMessage) PrettyPrint(w io.Writer)

func (*OperationalMessage) SetAsDeleteReplication

func (m *OperationalMessage) SetAsDeleteReplication()

func (*OperationalMessage) SetAsReplication

func (m *OperationalMessage) SetAsReplication()

func (*OperationalMessage) SetAsRequest

func (m *OperationalMessage) SetAsRequest()

func (*OperationalMessage) SetAsResponse

func (m *OperationalMessage) SetAsResponse()

func (*OperationalMessage) SetCorrelationID

func (m *OperationalMessage) SetCorrelationID(id []byte)

func (*OperationalMessage) SetCreationTime

func (m *OperationalMessage) SetCreationTime(value uint32)

func (*OperationalMessage) SetExpirationTime

func (m *OperationalMessage) SetExpirationTime(value uint32)

func (*OperationalMessage) SetKey

func (m *OperationalMessage) SetKey(key []byte)

func (*OperationalMessage) SetLastModificationTime

func (m *OperationalMessage) SetLastModificationTime(value uint64)

func (*OperationalMessage) SetMessage

func (op *OperationalMessage) SetMessage(opcode OpCode, key []byte, namespace []byte, payload *Payload, ttl uint32)

func (*OperationalMessage) SetNamespace

func (m *OperationalMessage) SetNamespace(namespace []byte)

func (*OperationalMessage) SetNewRequestID

func (m *OperationalMessage) SetNewRequestID()

func (*OperationalMessage) SetOpCode

func (m *OperationalMessage) SetOpCode(op OpCode)

func (*OperationalMessage) SetOpStatus

func (m *OperationalMessage) SetOpStatus(s OpStatus)

func (*OperationalMessage) SetOpaque

func (m *OperationalMessage) SetOpaque(opaque uint32)

func (*OperationalMessage) SetOriginatorRequestID

func (m *OperationalMessage) SetOriginatorRequestID(id RequestId)

func (*OperationalMessage) SetPayload

func (m *OperationalMessage) SetPayload(payload *Payload)

func (*OperationalMessage) SetRequest

func (op *OperationalMessage) SetRequest(opcode OpCode, key []byte, namespace []byte, payload *Payload, ttl uint32)

func (*OperationalMessage) SetRequestHandlingTime

func (m *OperationalMessage) SetRequestHandlingTime(value uint32)

func (*OperationalMessage) SetRequestID

func (m *OperationalMessage) SetRequestID(id RequestId)

func (*OperationalMessage) SetShardId

func (m *OperationalMessage) SetShardId(id uint16)

func (*OperationalMessage) SetSource

func (m *OperationalMessage) SetSource(ip net.IP, port uint16, appName []byte)

func (*OperationalMessage) SetTimeToLive

func (m *OperationalMessage) SetTimeToLive(value uint32)

func (*OperationalMessage) SetUDFName

func (m *OperationalMessage) SetUDFName(name []byte)

func (*OperationalMessage) SetVersion

func (m *OperationalMessage) SetVersion(version uint32)

func (*OperationalMessage) UnSetRequestID

func (m *OperationalMessage) UnSetRequestID()

type Payload

type Payload struct {
	// contains filtered or unexported fields
}

func (*Payload) Clear

func (p *Payload) Clear()

func (*Payload) Clone

func (p *Payload) Clone() (PayloadType, []byte)

func (*Payload) Decode

func (p *Payload) Decode(raw []byte, copyData bool)

func (*Payload) Decrypt

func (p *Payload) Decrypt() (err error)

func (*Payload) EncodeToBuffer

func (p *Payload) EncodeToBuffer(buffer *bytes.Buffer)

func (*Payload) Encrypt

func (p *Payload) Encrypt(pType PayloadType) (err error)

func (*Payload) Equal

func (p *Payload) Equal(other *Payload) bool

func (*Payload) GetClearValue

func (p *Payload) GetClearValue() (value []byte, err error)

/TODO

func (*Payload) GetData

func (p *Payload) GetData() []byte

func (*Payload) GetLength

func (p *Payload) GetLength() uint32

func (*Payload) GetPayloadType

func (p *Payload) GetPayloadType() PayloadType

func (*Payload) GetValueLength

func (p *Payload) GetValueLength() uint32

func (*Payload) PrettyPrint

func (p *Payload) PrettyPrint(w io.Writer)

func (*Payload) Set

func (p *Payload) Set(payload *Payload)

func (*Payload) SetPayload

func (p *Payload) SetPayload(tag PayloadType, data []byte)

func (*Payload) SetWithClearValue

func (p *Payload) SetWithClearValue(value []byte)

type PayloadType

type PayloadType uint8

func (PayloadType) String

func (t PayloadType) String() string

type ProtocolError

type ProtocolError struct {
	// contains filtered or unexported fields
}

func NewProtocolError

func NewProtocolError(err error) *ProtocolError

func (*ProtocolError) Error

func (e *ProtocolError) Error() string

type RawMessage

type RawMessage struct {
	// contains filtered or unexported fields
}

func (*RawMessage) Decode

func (h *RawMessage) Decode(raw []byte) error

func (*RawMessage) DeepCopy

func (m *RawMessage) DeepCopy(from *RawMessage)

func (*RawMessage) GetBody

func (m *RawMessage) GetBody() []byte

func (*RawMessage) GetMsgSize

func (h *RawMessage) GetMsgSize() uint32

func (*RawMessage) GetOpaque

func (h *RawMessage) GetOpaque() uint32

func (*RawMessage) GiveUpBufferOwnership

func (m *RawMessage) GiveUpBufferOwnership()

func (*RawMessage) HexDump

func (m *RawMessage) HexDump()

func (*RawMessage) IsSupported

func (h *RawMessage) IsSupported() bool

func (*RawMessage) PrettyPrint

func (h *RawMessage) PrettyPrint()

func (*RawMessage) PrintBytesForTest

func (m *RawMessage) PrintBytesForTest()

func (*RawMessage) Read

func (msg *RawMessage) Read(r io.Reader) (n int, err error)

Note: read timeout is set at conn level

func (*RawMessage) ReadWithHeader

func (msg *RawMessage) ReadWithHeader(header []byte, r io.Reader) (n int, err error)

func (*RawMessage) ReleaseBuffer

func (m *RawMessage) ReleaseBuffer()

func (*RawMessage) Reset

func (m *RawMessage) Reset()

func (*RawMessage) SetAsResponse

func (h *RawMessage) SetAsResponse()

func (*RawMessage) SetOpaque

func (h *RawMessage) SetOpaque(opaque uint32)

func (*RawMessage) ShallowCopy

func (m *RawMessage) ShallowCopy(from *RawMessage)

func (*RawMessage) ToHexString

func (m *RawMessage) ToHexString() string

func (*RawMessage) Write

func (m *RawMessage) Write(w io.Writer) (n int, err error)

Note: this api is not thread safe

type RequestId

type RequestId [16]byte

func (RequestId) Bytes

func (rid RequestId) Bytes() []byte

func (RequestId) Equal

func (rid RequestId) Equal(id RequestId) bool

func (RequestId) IsNotNil

func (rid RequestId) IsNotNil() bool

func (RequestId) IsSet

func (rid RequestId) IsSet() bool

func (RequestId) PrettyPrint

func (rid RequestId) PrettyPrint(w io.Writer)

func (*RequestId) SetFromBytes

func (rid *RequestId) SetFromBytes(b []byte) error

func (*RequestId) SetFromString

func (rid *RequestId) SetFromString(str string) error

func (*RequestId) SetNewRequestId

func (rid *RequestId) SetNewRequestId()

func (RequestId) String

func (rid RequestId) String() string

Directories

Path Synopsis
Package mayfly implements Mayfly binary message protocol.
Package mayfly implements Mayfly binary message protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL