msgpack

package
v0.0.0-...-9eea049 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	Read  bool
	Write bool
}

Indication whether the client can read or write the object in question.

func (*Capability) DecodeMsg

func (z *Capability) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Capability) EncodeMsg

func (z Capability) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Capability) FromCapnp

func (c *Capability) FromCapnp(msg msgs.Capability) *Capability

func (Capability) MarshalMsg

func (z Capability) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Capability) Msgsize

func (z Capability) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Capability) ToCapnp

func (c *Capability) ToCapnp(seg *capn.Segment) msgs.Capability

func (*Capability) UnmarshalMsg

func (z *Capability) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientAction

type ClientAction struct {
	// The Object Id. For newly created objects, the client should use
	// a uint64 in Big Endian as the first 8 bytes, followed by the
	// namespace as the latter 12 bytes. The client should maintain
	// independent counters for the created Object Id, and Txn Id.
	VarId []byte
	Value ClientActionValue
	Meta  ClientActionMeta
}

All ClientActions must specify the VarId and contain an action: either a create, xor a read, xor a write, xor a read and write. An AddSub requires a read xor create, and a DelSub requires a read. When the client sends this type to the server (as part of a Txn Submission), it may not use Missing. When the server sends this type to the client (as part of a ClientTxnOutcome) only Existing with Write, and Missing will be used.

func (*ClientAction) DecodeMsg

func (z *ClientAction) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientAction) EncodeMsg

func (z *ClientAction) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientAction) FromCapnp

func (a *ClientAction) FromCapnp(msg msgs.ClientAction) *ClientAction

func (*ClientAction) MarshalMsg

func (z *ClientAction) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientAction) Msgsize

func (z *ClientAction) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientAction) SetCapnp

func (a *ClientAction) SetCapnp(seg *capn.Segment, msg msgs.ClientAction) error

func (*ClientAction) UnmarshalMsg

func (z *ClientAction) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientActionMeta

type ClientActionMeta struct {
	// To subscribe to an object, set AddSub to true. The action must
	// also be either a read or a create. Once the transaction commits,
	// the server will asynchronously send updates to the client
	// whenever a subscribed object is modified. The updates are not
	// limited just to subscribed objects: if there is another
	// transaction which modifies both a subscribed object and another
	// object that the server knows the client has cached, then the
	// server may choose to send an update to the client that contains
	// updates to both objects.
	// It is legal to have multiple subscriptions to the same
	// object. But see the notes above in ClientTxnOutcome.
	AddSub bool
	// To unsubscribe from an object, set DelSub to the Transaction Id
	// of the transaction in which the subscription was added. Note
	// that this will not cancel any subscription other than the
	// indicated object and transaction Id. I.e. you can use this to
	// remove individual objects from a subscription if you wish. If
	// you have multiple subscriptions to the same object then you must
	// cancel all the subscriptions in different transactions one by
	// one (it is not legal to have a transaction mention the same
	// object multiple times, so you can only cancel one subscription
	// per object in a transaction).
	DelSub []byte
}

func (*ClientActionMeta) DecodeMsg

func (z *ClientActionMeta) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientActionMeta) EncodeMsg

func (z *ClientActionMeta) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientActionMeta) MarshalMsg

func (z *ClientActionMeta) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientActionMeta) Msgsize

func (z *ClientActionMeta) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientActionMeta) UnmarshalMsg

func (z *ClientActionMeta) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientActionValue

type ClientActionValue struct {
	// Missing is used by the server to indicate that it knows the
	// client's cached copy of this object is out of date, but the
	// server isn't able to provide an updated value at this point. So
	// the client must simply forget about this object, and if it needs
	// to access this object in the future, then it must reload it.
	Missing bool
	// Create is only used by the client when creating objects. It is
	// never used by the server for updates.
	Create *ClientActionValueCreate
	// The server will always use only Missing or Existing for updates.
	Existing *ClientActionValueExisting
}

func (*ClientActionValue) DecodeMsg

func (z *ClientActionValue) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientActionValue) EncodeMsg

func (z *ClientActionValue) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientActionValue) MarshalMsg

func (z *ClientActionValue) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientActionValue) Msgsize

func (z *ClientActionValue) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientActionValue) UnmarshalMsg

func (z *ClientActionValue) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientActionValueCreate

type ClientActionValueCreate struct {
	Value      []byte
	References []*ClientVarId
}

func (*ClientActionValueCreate) DecodeMsg

func (z *ClientActionValueCreate) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientActionValueCreate) EncodeMsg

func (z *ClientActionValueCreate) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientActionValueCreate) MarshalMsg

func (z *ClientActionValueCreate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientActionValueCreate) Msgsize

func (z *ClientActionValueCreate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientActionValueCreate) UnmarshalMsg

func (z *ClientActionValueCreate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientActionValueExisting

type ClientActionValueExisting struct {
	// Set true iff the transaction read the current value. Never used
	// in updates.
	Read bool
	// Set to undefined if there was no modification.
	Modify *ClientActionValueExistingModify
}

func (*ClientActionValueExisting) DecodeMsg

func (z *ClientActionValueExisting) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientActionValueExisting) EncodeMsg

func (z *ClientActionValueExisting) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientActionValueExisting) MarshalMsg

func (z *ClientActionValueExisting) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientActionValueExisting) Msgsize

func (z *ClientActionValueExisting) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientActionValueExisting) UnmarshalMsg

func (z *ClientActionValueExisting) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientActionValueExistingModify

type ClientActionValueExistingModify struct {
	Value      []byte
	References []*ClientVarId
}

func (*ClientActionValueExistingModify) DecodeMsg

func (z *ClientActionValueExistingModify) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientActionValueExistingModify) EncodeMsg

func (z *ClientActionValueExistingModify) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientActionValueExistingModify) MarshalMsg

func (z *ClientActionValueExistingModify) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientActionValueExistingModify) Msgsize

func (z *ClientActionValueExistingModify) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientActionValueExistingModify) UnmarshalMsg

func (z *ClientActionValueExistingModify) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientMessage

type ClientMessage struct {
	ClientTxnSubmission *ClientTxn
	ClientTxnOutcome    *ClientTxnOutcome
}

General container for messages between client and server once the connection is up (i.e. post the HelloClientFromServer msg). The client only ever sends ClientMessages with ClientTxnSubmission, and the client only ever receives ClientMessages with ClientTxnOutcomes.

func (*ClientMessage) DecodeMsg

func (z *ClientMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientMessage) EncodeMsg

func (z *ClientMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientMessage) MarshalMsg

func (z *ClientMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientMessage) Msgsize

func (z *ClientMessage) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientMessage) UnmarshalMsg

func (z *ClientMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientTxn

type ClientTxn struct {
	// The TxnId. The first 8 bytes are a uint64 in Big Endian, the
	// remaining 12 bytes are the contents of the Namespace from
	// HelloClientFromServer. The number that is encoded into the first
	// 8 bytes should start from 0, and always increase. See also
	// FinalId below.
	Id []byte
	// The Counter is essentially a version indicator: it is used to
	// indicate the version a client is at, and so the client must
	// maintain, per connection, a counter value. The initial value of
	// the Counter is 0. When subscriptions are in use, an update from
	// a subscription can cause the counter to increase. The client
	// must always send a ClientTxn with Counter set to the value of
	// counter when the transaction started on the client, even if
	// updates arrived from the server during the transaction. This
	// value is used to detect when a transaction which is sent to the
	// server concurrently with the server sending an update due to a
	// subscription.
	Counter uint64
	Actions []*ClientAction
}

func (*ClientTxn) DecodeMsg

func (z *ClientTxn) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientTxn) EncodeMsg

func (z *ClientTxn) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientTxn) FromCapnp

func (ctxn *ClientTxn) FromCapnp(msg msgs.ClientTxn) *ClientTxn

func (*ClientTxn) MarshalMsg

func (z *ClientTxn) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientTxn) Msgsize

func (z *ClientTxn) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientTxn) ToCapnp

func (ctxn *ClientTxn) ToCapnp(seg *capn.Segment) (*msgs.ClientTxn, error)

func (*ClientTxn) UnmarshalMsg

func (z *ClientTxn) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientTxnOutcome

type ClientTxnOutcome struct {
	// The TxnId with which the client submitted this txn. Outcomes are
	// also used for subscription updates, in which case the Id will be
	// the Id of the transaction that created the subscription. The
	// client will never be sent duplicate updates for an object even
	// if the client has multiple subscriptions for the same object
	// (which is legal). But in this case it is undetermined which of
	// the subscriptions will receive the update; only that one of them
	// will.
	Id []byte
	// The final TxnId of this txn. The latter 12 bytes are guaranteed
	// to be unchanged. The first 8 bytes should be read as a uint64 in
	// Big Endian. This number is guaranteed to be >= the corresponding
	// 8 bytes in the Id that the client submitted the txn with. The
	// client should update itself to ensure that the next txn it
	// submits has an Id > the FinalId for this number. Gaps are
	// acceptable, but pointless. The reason the FinalId can be
	// different from the Id is that the server may itself encounter
	// situations in which it must resubmit the txn which requires a
	// new txn Id.
	// If the outcome is for a subscription then the FinalId will be
	// empty.
	FinalId []byte
	// The updated counter. This value should be used for the next
	// transaction that is started after this outcome is received and
	// processed.
	Counter uint64
	// True iff the transaction committed. Commit, Abort and Error are
	// all mutually exclusive.
	Commit bool
	// If the txn failed to commit, and did not error, then
	// Abort.length will not be undefined. Abort will contain the
	// updates which the client should apply to its cache and then the
	// client should rerun the transaction. Note in some cases (see
	// notes on subscriptions below), the list may have 0 length.
	Abort []*ClientAction
	// If some error occured then this is provided.
	Error string
}

func (*ClientTxnOutcome) DecodeMsg

func (z *ClientTxnOutcome) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientTxnOutcome) EncodeMsg

func (z *ClientTxnOutcome) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientTxnOutcome) FromCapnp

func (*ClientTxnOutcome) MarshalMsg

func (z *ClientTxnOutcome) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientTxnOutcome) Msgsize

func (z *ClientTxnOutcome) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientTxnOutcome) UnmarshalMsg

func (z *ClientTxnOutcome) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientVarId

type ClientVarId struct {
	VarId      []byte
	Capability *Capability
}

Pointers in GoshawkDB not only indicate the Id of the object being pointed to, but also contain a capability which constains the actions that can be performed against the destination object. See https://goshawkdb.io/documentation/capabilities.html for more details.

func (*ClientVarId) DecodeMsg

func (z *ClientVarId) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientVarId) EncodeMsg

func (z *ClientVarId) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientVarId) FromCapnp

func (cvi *ClientVarId) FromCapnp(msg msgs.ClientVarIdPos) *ClientVarId

func (*ClientVarId) MarshalMsg

func (z *ClientVarId) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientVarId) Msgsize

func (z *ClientVarId) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ClientVarId) SetCapnp

func (cvi *ClientVarId) SetCapnp(seg *capn.Segment, msg msgs.ClientVarIdPos) error

func (*ClientVarId) UnmarshalMsg

func (z *ClientVarId) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Hello

type Hello struct {
	Product string
	Version string
}

Sent by the client to the server once the socket is established, and concurrently sent by the server to the client once the socket is established.

func (*Hello) DecodeMsg

func (z *Hello) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Hello) EncodeMsg

func (z Hello) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Hello) MarshalMsg

func (z Hello) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Hello) Msgsize

func (z Hello) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Hello) UnmarshalMsg

func (z *Hello) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type HelloClientFromServer

type HelloClientFromServer struct {
	// 12 bytes. These form the latter 12 bytes of the 20-byte TxnIds
	// and new VarIds.
	Namespace []byte
	// The roots this client account has been configured with.
	Roots []*Root
}

Sent by the server to the client after the Hello's have been exchanged; assuming everything's with the Hello.

func (*HelloClientFromServer) DecodeMsg

func (z *HelloClientFromServer) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*HelloClientFromServer) EncodeMsg

func (z *HelloClientFromServer) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*HelloClientFromServer) MarshalMsg

func (z *HelloClientFromServer) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*HelloClientFromServer) Msgsize

func (z *HelloClientFromServer) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*HelloClientFromServer) UnmarshalMsg

func (z *HelloClientFromServer) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Root

type Root struct {
	Name       string
	VarId      []byte
	Capability *Capability
}

Part of the HelloClientFromServer msg

func (*Root) DecodeMsg

func (z *Root) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Root) EncodeMsg

func (z *Root) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Root) FromCapnp

func (r *Root) FromCapnp(msg msgs.Root) *Root

func (*Root) MarshalMsg

func (z *Root) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Root) Msgsize

func (z *Root) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Root) UnmarshalMsg

func (z *Root) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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