store

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCOL_V1 = "/cluster/store/0.0.1"
)

Variables

This section is empty.

Functions

func DSQuery

func DSQuery(q Query) dsq.Query

func NewStoreClient

func NewStoreClient(ctx context.Context, src host.Host, target peer.AddrInfo, pid protocol.ID) core.DataNodeClient

func NewStoreServer

func NewStoreServer(ctx context.Context, h host.Host, pid protocol.ID, ds ds.Datastore, disableDelete bool) core.DataNodeServer

func ReadQueryResultEntry

func ReadQueryResultEntry(s network.Stream, msg *QueryResultEntry) error

func ReadReplyMsg

func ReadReplyMsg(s network.Stream, msg *ReplyMessage) error

func ReadRequestMsg

func ReadRequestMsg(s network.Stream, msg *RequestMessage) error

func WriteQueryResultEntry

func WriteQueryResultEntry(s network.Stream, msg *QueryResultEntry) error

func WriteReplyMsg

func WriteReplyMsg(s network.Stream, msg *ReplyMessage) error

func WriteRequstMsg

func WriteRequstMsg(s network.Stream, msg *RequestMessage) error

Types

type Act

type Act uint8
const (
	ActPut Act = 1 + iota
	ActDelete
	ActGet
	ActGetSize
	ActHas
	ActQuery
)

func (Act) String added in v0.0.8

func (act Act) String() string

type ErrCode

type ErrCode uint8
const (
	ErrNone ErrCode = iota
	ErrNotFound
	ErrQueryResultEnd

	ErrOthers = 100
)

type Query

type Query struct {
	Prefix   string
	Limit    int64
	Offset   int64
	KeysOnly bool
}

func P2PQuery

func P2PQuery(q dsq.Query) Query

func (*Query) MarshalCBOR

func (t *Query) MarshalCBOR(w io.Writer) error

func (*Query) UnmarshalCBOR

func (t *Query) UnmarshalCBOR(r io.Reader) error

type QueryResultEntry

type QueryResultEntry struct {
	Code  ErrCode
	Msg   string
	Key   string
	Value []byte
	Size  int64
}

func (*QueryResultEntry) MarshalCBOR

func (t *QueryResultEntry) MarshalCBOR(w io.Writer) error

func (*QueryResultEntry) UnmarshalCBOR

func (t *QueryResultEntry) UnmarshalCBOR(r io.Reader) error

type ReplyMessage

type ReplyMessage struct {
	Code   ErrCode
	Msg    string
	Value  []byte
	Size   int64
	Exists bool
}

func (*ReplyMessage) MarshalCBOR

func (t *ReplyMessage) MarshalCBOR(w io.Writer) error

func (*ReplyMessage) UnmarshalCBOR

func (t *ReplyMessage) UnmarshalCBOR(r io.Reader) error

type RequestMessage

type RequestMessage struct {
	Key    string
	Value  []byte
	Query  Query
	Action Act
}

func (*RequestMessage) MarshalCBOR

func (t *RequestMessage) MarshalCBOR(w io.Writer) error

func (*RequestMessage) UnmarshalCBOR

func (t *RequestMessage) UnmarshalCBOR(r io.Reader) error

Jump to

Keyboard shortcuts

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