Documentation ¶
Index ¶
- Variables
- func CreateTags(streamIds ...common.Hash) []byte
- type AccessControl
- type AccessControlBuilder
- func (builder *AccessControlBuilder) AddStreamId(streamId common.Hash)
- func (builder *AccessControlBuilder) Build() ([]AccessControl, error)
- func (builder *AccessControlBuilder) BuildTags(sorted ...bool) []byte
- func (builder *AccessControlBuilder) GrantAdminRole(streamId common.Hash, account common.Address) *AccessControlBuilder
- func (builder *AccessControlBuilder) GrantSpecialWriteRole(streamId common.Hash, key []byte, account common.Address) *AccessControlBuilder
- func (builder *AccessControlBuilder) GrantWriteRole(streamId common.Hash, account common.Address) *AccessControlBuilder
- func (builder *AccessControlBuilder) RenounceAdminRole(streamId common.Hash) *AccessControlBuilder
- func (builder *AccessControlBuilder) RenounceSpecialWriteRole(streamId common.Hash, key []byte) *AccessControlBuilder
- func (builder *AccessControlBuilder) RenounceWriteRole(streamId common.Hash) *AccessControlBuilder
- func (builder *AccessControlBuilder) RevokeSpecialWriteRole(streamId common.Hash, key []byte, account common.Address) *AccessControlBuilder
- func (builder *AccessControlBuilder) RevokeWriteRole(streamId common.Hash, account common.Address) *AccessControlBuilder
- func (builder *AccessControlBuilder) SetKeyToNormal(streamId common.Hash, key []byte) *AccessControlBuilder
- func (builder *AccessControlBuilder) SetKeyToSpecial(streamId common.Hash, key []byte) *AccessControlBuilder
- type AccessControlType
- type Batcher
- type Client
- func (c *Client) Batcher() *Batcher
- func (c *Client) Get(streamId common.Hash, key []byte, startIndex, length uint64, version ...uint64) (val *node.Value, err error)
- func (c *Client) GetFirst(streamId common.Hash, startIndex, length uint64, version ...uint64) (val *node.KeyValue, err error)
- func (c *Client) GetHoldingStreamIds() (streamIds []common.Hash, err error)
- func (c *Client) GetLast(streamId common.Hash, startIndex, length uint64, version ...uint64) (val *node.KeyValue, err error)
- func (c *Client) GetNext(streamId common.Hash, key []byte, startIndex, length uint64, inclusive bool, ...) (val *node.KeyValue, err error)
- func (c *Client) GetPrev(streamId common.Hash, key []byte, startIndex, length uint64, inclusive bool, ...) (val *node.KeyValue, err error)
- func (c *Client) GetTransactionResult(txSeq uint64) (result string, err error)
- func (c *Client) GetValue(streamId common.Hash, key []byte, version ...uint64) (val *node.Value, err error)
- func (c *Client) HasWritePermission(account common.Address, streamId common.Hash, key []byte, version ...uint64) (hasPermission bool, err error)
- func (c *Client) IsAdmin(account common.Address, streamId common.Hash, version ...uint64) (isAdmin bool, err error)
- func (c *Client) IsSpecialKey(streamId common.Hash, key []byte, version ...uint64) (isSpecialKey bool, err error)
- func (c *Client) IsWriterOfKey(account common.Address, streamId common.Hash, key []byte, version ...uint64) (isWriter bool, err error)
- func (c *Client) IsWriterOfStream(account common.Address, streamId common.Hash, version ...uint64) (isWriter bool, err error)
- func (c *Client) NewIterator(streamId common.Hash, version ...uint64) *Iterator
- type Iterator
- func (iter *Iterator) KeyValue() *node.KeyValue
- func (iter *Iterator) Next() error
- func (iter *Iterator) Prev() error
- func (iter *Iterator) SeekAfter(key []byte) error
- func (iter *Iterator) SeekBefore(key []byte) error
- func (iter *Iterator) SeekToFirst() error
- func (iter *Iterator) SeekToLast() error
- func (iter *Iterator) Valid() bool
- type StreamData
- type StreamDataBuilder
- func (builder *StreamDataBuilder) AddStreamId(streamId common.Hash)
- func (builder *StreamDataBuilder) Build(sorted ...bool) (*StreamData, error)
- func (builder *StreamDataBuilder) BuildTags(sorted ...bool) []byte
- func (builder *StreamDataBuilder) Set(streamId common.Hash, key []byte, data []byte) *StreamDataBuilder
- func (builder *StreamDataBuilder) SetVersion(version uint64) *StreamDataBuilder
- func (builder *StreamDataBuilder) Watch(streamId common.Hash, key []byte) *StreamDataBuilder
- type StreamRead
- type StreamWrite
Constants ¶
This section is empty.
Variables ¶
df2ff3bb0af36c6384e6206552a4ed807f6f6a26e7d0aa6bff772ddc9d4307aa
Functions ¶
func CreateTags ¶
Types ¶
type AccessControl ¶
type AccessControlBuilder ¶
type AccessControlBuilder struct {
// contains filtered or unexported fields
}
func (*AccessControlBuilder) AddStreamId ¶
func (*AccessControlBuilder) Build ¶
func (builder *AccessControlBuilder) Build() ([]AccessControl, error)
func (*AccessControlBuilder) GrantAdminRole ¶
func (builder *AccessControlBuilder) GrantAdminRole(streamId common.Hash, account common.Address) *AccessControlBuilder
func (*AccessControlBuilder) GrantSpecialWriteRole ¶
func (builder *AccessControlBuilder) GrantSpecialWriteRole(streamId common.Hash, key []byte, account common.Address) *AccessControlBuilder
func (*AccessControlBuilder) GrantWriteRole ¶
func (builder *AccessControlBuilder) GrantWriteRole(streamId common.Hash, account common.Address) *AccessControlBuilder
func (*AccessControlBuilder) RenounceAdminRole ¶
func (builder *AccessControlBuilder) RenounceAdminRole(streamId common.Hash) *AccessControlBuilder
func (*AccessControlBuilder) RenounceSpecialWriteRole ¶
func (builder *AccessControlBuilder) RenounceSpecialWriteRole(streamId common.Hash, key []byte) *AccessControlBuilder
func (*AccessControlBuilder) RenounceWriteRole ¶
func (builder *AccessControlBuilder) RenounceWriteRole(streamId common.Hash) *AccessControlBuilder
func (*AccessControlBuilder) RevokeSpecialWriteRole ¶
func (builder *AccessControlBuilder) RevokeSpecialWriteRole(streamId common.Hash, key []byte, account common.Address) *AccessControlBuilder
func (*AccessControlBuilder) RevokeWriteRole ¶
func (builder *AccessControlBuilder) RevokeWriteRole(streamId common.Hash, account common.Address) *AccessControlBuilder
func (*AccessControlBuilder) SetKeyToNormal ¶
func (builder *AccessControlBuilder) SetKeyToNormal(streamId common.Hash, key []byte) *AccessControlBuilder
func (*AccessControlBuilder) SetKeyToSpecial ¶
func (builder *AccessControlBuilder) SetKeyToSpecial(streamId common.Hash, key []byte) *AccessControlBuilder
type AccessControlType ¶
type AccessControlType uint8
const ( // Admin role AclTypeGrantAdminRole AccessControlType = 0x00 AclTypeRenounceAdminRole AccessControlType = 0x01 // set/unset special key AclTypeSetKeyToSpecial AccessControlType = 0x10 AclTypeSetKeyToNormal AccessControlType = 0x11 // Write role for all keys AclTypeGrantWriteRole AccessControlType = 0x20 AclTypeRevokeWriteRole AccessControlType = 0x21 AclTypeRenounceWriteRole AccessControlType = 0x22 // Write role for special key AclTypeGrantSpecialWriteRole AccessControlType = 0x30 AclTypeRevokeSpecialWriteRole AccessControlType = 0x31 AclTypeRenounceSpecialWriteRole AccessControlType = 0x32 )
type Batcher ¶
type Batcher struct { *StreamDataBuilder // contains filtered or unexported fields }
func (Batcher) AddStreamId ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used for users to communicate with server for kv operations.
func NewClient ¶
func NewClient(node *node.Client, flow *contract.FlowContract) *Client
NewClient creates a new client for kv operations.
Generally, you could refer to the `upload` function in `cmd/upload.go` file for how to create storage node client and flow contract client.
func (*Client) Get ¶
func (c *Client) Get(streamId common.Hash, key []byte, startIndex, length uint64, version ...uint64) (val *node.Value, err error)
Get returns paginated value for the specified stream key and offset.
func (*Client) GetHoldingStreamIds ¶
func (*Client) GetTransactionResult ¶
func (*Client) HasWritePermission ¶
func (*Client) IsSpecialKey ¶
func (*Client) IsWriterOfKey ¶
func (*Client) IsWriterOfStream ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func (*Iterator) SeekBefore ¶
func (*Iterator) SeekToFirst ¶
func (*Iterator) SeekToLast ¶
type StreamData ¶
type StreamData struct { Version uint64 Reads []StreamRead Writes []StreamWrite Controls []AccessControl }
func (*StreamData) Encode ¶
func (sd *StreamData) Encode() ([]byte, error)
func (*StreamData) Size ¶
func (sd *StreamData) Size() int
Size returns the serialized data size in bytes.
type StreamDataBuilder ¶
type StreamDataBuilder struct { AccessControlBuilder // contains filtered or unexported fields }
func NewStreamDataBuilder ¶
func NewStreamDataBuilder(version uint64) *StreamDataBuilder
func (*StreamDataBuilder) AddStreamId ¶
func (*StreamDataBuilder) Build ¶
func (builder *StreamDataBuilder) Build(sorted ...bool) (*StreamData, error)
func (*StreamDataBuilder) Set ¶
func (builder *StreamDataBuilder) Set(streamId common.Hash, key []byte, data []byte) *StreamDataBuilder
func (*StreamDataBuilder) SetVersion ¶
func (builder *StreamDataBuilder) SetVersion(version uint64) *StreamDataBuilder
func (*StreamDataBuilder) Watch ¶
func (builder *StreamDataBuilder) Watch(streamId common.Hash, key []byte) *StreamDataBuilder
type StreamRead ¶
Click to show internal directories.
Click to hide internal directories.