Documentation ¶
Overview ¶
Package light implements an Accumulate light client.
THIS PACKAGE IS EXPERIMENTAL AND SUBJECT TO CHANGE. ¶
Index ¶
- func ByAnchorBlock(block uint64) func(*AnchorMetadata) bool
- func ByIndexBlock(block uint64) func(*protocol.IndexEntry) bool
- func ByIndexRootIndexIndex(rootIndex uint64) func(*protocol.IndexEntry) bool
- func ByIndexSource(source uint64) func(*protocol.IndexEntry) bool
- func FindEntry[T any](entries []T, fn func(T) bool) (int, T, bool)
- type AnchorMetadata
- func (v *AnchorMetadata) Copy() *AnchorMetadata
- func (v *AnchorMetadata) CopyAsInterface() interface{}
- func (v *AnchorMetadata) Equal(u *AnchorMetadata) bool
- func (v *AnchorMetadata) IsValid() error
- func (v *AnchorMetadata) MarshalBinary() ([]byte, error)
- func (v *AnchorMetadata) MarshalJSON() ([]byte, error)
- func (v *AnchorMetadata) UnmarshalBinary(data []byte) error
- func (v *AnchorMetadata) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *AnchorMetadata) UnmarshalJSON(b []byte) error
- type Client
- func (c *Client) Close() error
- func (c *Client) IndexAccountChains(ctx context.Context, acctUrl *url.URL) error
- func (c *Client) IndexAccountTransactions(ctx context.Context, accounts ...*url.URL) error
- func (c *Client) IndexAnchors(ctx context.Context, partUrl *url.URL) error
- func (c *Client) OpenDB(writable bool) *DB
- func (c *Client) PullAccount(ctx context.Context, acctUrl *url.URL) error
- func (c *Client) PullMessagesForAccount(ctx context.Context, account *url.URL, chains ...string) error
- func (c *Client) PullPendingTransactionsForAccount(ctx context.Context, account *url.URL) error
- func (c *Client) PullTransactions(ctx context.Context, txids ...*url.TxID) error
- func (c *Client) PullTransactionsForAccount(ctx context.Context, account *url.URL, chains ...string) error
- type ClientOption
- func BadgerStore(filepath string) ClientOption
- func ClientV2(client *client.Client) ClientOption
- func Logger(logger log.Logger, keyVals ...any) ClientOption
- func MemoryStore() ClientOption
- func Querier(querier api.Querier) ClientOption
- func Server(server string) ClientOption
- func Store(s keyvalue.Beginner, prefix string) ClientOption
- type DB
- type EventMetadata
- func (v *EventMetadata) Copy() *EventMetadata
- func (v *EventMetadata) CopyAsInterface() interface{}
- func (v *EventMetadata) Equal(u *EventMetadata) bool
- func (v *EventMetadata) IsValid() error
- func (v *EventMetadata) MarshalBinary() ([]byte, error)
- func (v *EventMetadata) MarshalJSON() ([]byte, error)
- func (v *EventMetadata) UnmarshalBinary(data []byte) error
- func (v *EventMetadata) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *EventMetadata) UnmarshalJSON(b []byte) error
- type IndexDB
- type IndexDBAccount
- type IndexDBAccountChain
- type IndexDBPartition
- type IndexDBTransaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByAnchorBlock ¶
func ByAnchorBlock(block uint64) func(*AnchorMetadata) bool
ByAnchorBlock searches for an anchor entry with protocol.AnchorMetadata.MinorBlockIndex equal to or greater than the given value.
func ByIndexBlock ¶
func ByIndexBlock(block uint64) func(*protocol.IndexEntry) bool
ByIndexBlock searches for an index entry with protocol.IndexEntry.BlockIndex equal to or greater than the given value.
func ByIndexRootIndexIndex ¶
func ByIndexRootIndexIndex(rootIndex uint64) func(*protocol.IndexEntry) bool
ByIndexRootIndexIndex searches for an index entry with protocol.IndexEntry.RootIndexIndex equal to or greater than the given value.
func ByIndexSource ¶
func ByIndexSource(source uint64) func(*protocol.IndexEntry) bool
ByIndexSource searches for an index entry with protocol.IndexEntry.Source equal to or greater than the given value.
Types ¶
type AnchorMetadata ¶
type AnchorMetadata struct { Index uint64 `json:"index,omitempty" form:"index" query:"index" validate:"required"` Hash [32]byte `json:"hash,omitempty" form:"hash" query:"hash" validate:"required"` Anchor *protocol.PartitionAnchor `json:"anchor,omitempty" form:"anchor" query:"anchor" validate:"required"` // contains filtered or unexported fields }
func (*AnchorMetadata) Copy ¶
func (v *AnchorMetadata) Copy() *AnchorMetadata
func (*AnchorMetadata) CopyAsInterface ¶
func (v *AnchorMetadata) CopyAsInterface() interface{}
func (*AnchorMetadata) Equal ¶
func (v *AnchorMetadata) Equal(u *AnchorMetadata) bool
func (*AnchorMetadata) IsValid ¶
func (v *AnchorMetadata) IsValid() error
func (*AnchorMetadata) MarshalBinary ¶
func (v *AnchorMetadata) MarshalBinary() ([]byte, error)
func (*AnchorMetadata) MarshalJSON ¶
func (v *AnchorMetadata) MarshalJSON() ([]byte, error)
func (*AnchorMetadata) UnmarshalBinary ¶
func (v *AnchorMetadata) UnmarshalBinary(data []byte) error
func (*AnchorMetadata) UnmarshalBinaryFrom ¶
func (v *AnchorMetadata) UnmarshalBinaryFrom(rd io.Reader) error
func (*AnchorMetadata) UnmarshalJSON ¶
func (v *AnchorMetadata) UnmarshalJSON(b []byte) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a light client instance.
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient creates a new light client instance.
func (*Client) IndexAccountChains ¶
IndexAccountChains collates the index chain entries for an account's chains.
func (*Client) IndexAccountTransactions ¶
IndexAccountTransaction indexes the local and directory block index and time for the accounts' main chain transactions.
func (*Client) IndexAnchors ¶
IndexAnchors collates a partition's block anchors.
func (*Client) PullAccount ¶
PullAccount fetches the latest version of the account and its chains.
func (*Client) PullMessagesForAccount ¶ added in v1.2.0
func (*Client) PullPendingTransactionsForAccount ¶
func (*Client) PullTransactions ¶
PullTransaction fetches a set of transactions.
type ClientOption ¶
func BadgerStore ¶
func BadgerStore(filepath string) ClientOption
func ClientV2 ¶
func ClientV2(client *client.Client) ClientOption
func MemoryStore ¶
func MemoryStore() ClientOption
func Querier ¶ added in v1.2.0
func Querier(querier api.Querier) ClientOption
func Server ¶
func Server(server string) ClientOption
type EventMetadata ¶
type EventMetadata struct { LocalBlock uint64 `json:"localBlock,omitempty" form:"localBlock" query:"localBlock" validate:"required"` LocalTime time.Time `json:"localTime,omitempty" form:"localTime" query:"localTime" validate:"required"` DirectoryBlock uint64 `json:"directoryBlock,omitempty" form:"directoryBlock" query:"directoryBlock" validate:"required"` DirectoryTime time.Time `json:"directoryTime,omitempty" form:"directoryTime" query:"directoryTime" validate:"required"` // contains filtered or unexported fields }
func (*EventMetadata) Copy ¶
func (v *EventMetadata) Copy() *EventMetadata
func (*EventMetadata) CopyAsInterface ¶
func (v *EventMetadata) CopyAsInterface() interface{}
func (*EventMetadata) Equal ¶
func (v *EventMetadata) Equal(u *EventMetadata) bool
func (*EventMetadata) IsValid ¶
func (v *EventMetadata) IsValid() error
func (*EventMetadata) MarshalBinary ¶
func (v *EventMetadata) MarshalBinary() ([]byte, error)
func (*EventMetadata) MarshalJSON ¶
func (v *EventMetadata) MarshalJSON() ([]byte, error)
func (*EventMetadata) UnmarshalBinary ¶
func (v *EventMetadata) UnmarshalBinary(data []byte) error
func (*EventMetadata) UnmarshalBinaryFrom ¶
func (v *EventMetadata) UnmarshalBinaryFrom(rd io.Reader) error
func (*EventMetadata) UnmarshalJSON ¶
func (v *EventMetadata) UnmarshalJSON(b []byte) error
type IndexDB ¶
type IndexDB interface { record.Record Account(url *url.URL) IndexDBAccount Partition(url *url.URL) IndexDBPartition Transaction(hash [32]byte) IndexDBTransaction }
type IndexDBAccount ¶
type IndexDBAccountChain ¶
type IndexDBPartition ¶
type IndexDBPartition interface { record.Record Anchors() values.List[*AnchorMetadata] }
type IndexDBTransaction ¶
type IndexDBTransaction interface { record.Record Executed() values.Value[*EventMetadata] }