Documentation ¶
Index ¶
- type Account
- func (r *Account) Chain(name string, typ protocol.ChainType) (*Chain, error)
- func (r *Account) Data() (*Data, error)
- func (r *Account) GetObject() (*protocol.ObjectMetadata, error)
- func (r *Account) GetState() (protocol.Account, error)
- func (r *Account) GetStateAs(state interface{}) error
- func (r *Account) Index(key ...interface{}) *Value
- func (r *Account) IndexChain(name string, major bool) (*Chain, error)
- func (r *Account) PutBpt(hash [32]byte)
- func (r *Account) PutState(state protocol.Account) error
- func (r *Account) ReadChain(name string) (*Chain, error)
- func (r *Account) ReadIndexChain(name string, major bool) (*Chain, error)
- func (r *Account) StateHash() ([]byte, error)
- type Batch
- func (b *Batch) Account(u *url.URL) *Account
- func (b *Batch) AccountByID(id []byte) *Accountdeprecated
- func (b *Batch) AccountByKey(key storage.Key) *Account
- func (b *Batch) Begin() *Batch
- func (b *Batch) Commit() error
- func (b *Batch) CommitBpt() ([]byte, error)
- func (b *Batch) Discard()
- func (b *Batch) GetMinorRootChainAnchor(network *config.Network) ([]byte, error)
- func (b *Batch) Import(db interface{ ... }) error
- func (b *Batch) Transaction(id []byte) *Transaction
- type Chain
- func (c *Chain) AddEntry(entry []byte, unique bool) error
- func (c *Chain) Anchor() []byte
- func (c *Chain) CurrentState() *managed.MerkleState
- func (c *Chain) Entries(start int64, end int64) ([][]byte, error)
- func (c *Chain) Entry(height int64) ([]byte, error)
- func (c *Chain) EntryAs(height int64, value encoding.BinaryUnmarshaler) error
- func (c *Chain) Height() int64
- func (c *Chain) HeightOf(hash []byte) (int64, error)
- func (c *Chain) Pending() []managed.Hash
- func (c *Chain) Receipt(from, to int64) (*managed.Receipt, error)
- func (c *Chain) State(height int64) (*managed.MerkleState, error)
- type Data
- func (d *Data) Entry(height int64) (*protocol.DataEntry, error)
- func (d *Data) Get(hash []byte) (*protocol.DataEntry, error)
- func (d *Data) GetHashes(start, end int64) ([][]byte, error)
- func (d *Data) GetLatest() ([]byte, *protocol.DataEntry, error)
- func (d *Data) Height() int64
- func (d *Data) Put(hash []byte, entry *protocol.DataEntry) error
- type Database
- func New(store storage.KeyValueStore, logger log.Logger) *Database
- func Open(cfg *config.Config, logger log.Logger) (*Database, error)
- func OpenBadger(filepath string, logger log.Logger) (*Database, error)
- func OpenEtcd(prefix string, config *clientv3.Config, logger log.Logger) (*Database, error)
- func OpenInMemory(logger log.Logger) *Database
- type SignatureSet
- func (s *SignatureSet) Add(newSignatures ...protocol.Signature) int
- func (v *SignatureSet) Copy() *SignatureSet
- func (v *SignatureSet) CopyAsInterface() interface{}
- func (s *SignatureSet) Count() int
- func (v *SignatureSet) Equal(u *SignatureSet) bool
- func (v *SignatureSet) IsValid() error
- func (v *SignatureSet) MarshalBinary() ([]byte, error)
- func (v *SignatureSet) MarshalJSON() ([]byte, error)
- func (v *SignatureSet) UnmarshalBinary(data []byte) error
- func (v *SignatureSet) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *SignatureSet) UnmarshalJSON(data []byte) error
- type Transaction
- func (t *Transaction) AddSyntheticTxns(txids ...[32]byte) error
- func (t *Transaction) Get() (*protocol.Envelope, *protocol.TransactionStatus, []protocol.Signature, error)
- func (t *Transaction) GetSignatures() (*SignatureSet, error)
- func (t *Transaction) GetState() (*protocol.Envelope, error)
- func (t *Transaction) GetStatus() (*protocol.TransactionStatus, error)
- func (t *Transaction) GetSyntheticTxns() (*protocol.HashSet, error)
- func (t *Transaction) Index(key ...interface{}) *Value
- func (t *Transaction) Put(state *protocol.Envelope, status *protocol.TransactionStatus, ...) error
- func (t *Transaction) PutSignatures(v *SignatureSet) error
- func (t *Transaction) PutState(v *protocol.Envelope) error
- func (t *Transaction) PutStatus(v *protocol.TransactionStatus) error
- func (t *Transaction) PutSyntheticTxns(v *protocol.HashSet) error
- type TypedValue
- type Value
- type ValueUnmarshalFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account manages a record.
func (*Account) GetObject ¶
func (r *Account) GetObject() (*protocol.ObjectMetadata, error)
GetObject loads the object metadata.
func (*Account) GetStateAs ¶
GetStateAs loads the record state and unmarshals into the given value. In most cases `state` should be a double pointer.
func (*Account) IndexChain ¶ added in v0.5.1
IndexChain returns a chain manager for the index chain of the given chain.
func (*Account) PutState ¶
PutState stores the record state and adds the record to the BPT (as a hash).
func (*Account) ReadIndexChain ¶ added in v0.5.1
ReadIndexChain returns a read-only chain manager for the index chain of the given chain.
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch batches database writes.
func (*Batch) AccountByID
deprecated
func (*Batch) AccountByKey ¶ added in v0.5.1
AccountByKey returns an Account for the given storage key. This is used for creating snapshots from the BPT.
func (*Batch) Commit ¶
Commit commits pending writes to the key-value store or the parent batch. Attempting to use the Batch after calling Commit or Discard will result in a panic.
func (*Batch) CommitBpt ¶ added in v0.5.1
CommitBpt updates the Patricia Tree hashes with the values from the updates since the last update.
func (*Batch) Discard ¶
func (b *Batch) Discard()
Discard discards pending writes. Attempting to use the Batch after calling Discard will result in a panic.
func (*Batch) GetMinorRootChainAnchor ¶ added in v0.5.1
func (*Batch) Transaction ¶
func (b *Batch) Transaction(id []byte) *Transaction
Transaction returns a Transaction for the given transaction ID.
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain manages a Merkle tree (chain).
func (*Chain) CurrentState ¶ added in v0.5.1
func (c *Chain) CurrentState() *managed.MerkleState
CurrentState returns the current state of the chain.
func (*Chain) EntryAs ¶ added in v0.5.1
func (c *Chain) EntryAs(height int64, value encoding.BinaryUnmarshaler) error
EntryAs loads and unmarshals the entry in the chain at the given height.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data manages a data chain.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is an Accumulate database.
func New ¶
func New(store storage.KeyValueStore, logger log.Logger) *Database
New creates a new database using the given key-value store.
func OpenBadger ¶ added in v0.5.1
func OpenInMemory ¶ added in v0.5.1
type SignatureSet ¶ added in v0.5.1
type SignatureSet struct { Signatures []protocol.Signature `json:"signatures,omitempty" form:"signatures" query:"signatures" validate:"required"` // contains filtered or unexported fields }
func (*SignatureSet) Add ¶ added in v0.5.1
func (s *SignatureSet) Add(newSignatures ...protocol.Signature) int
func (*SignatureSet) Copy ¶
func (v *SignatureSet) Copy() *SignatureSet
func (*SignatureSet) CopyAsInterface ¶
func (v *SignatureSet) CopyAsInterface() interface{}
func (*SignatureSet) Count ¶ added in v0.5.1
func (s *SignatureSet) Count() int
func (*SignatureSet) Equal ¶
func (v *SignatureSet) Equal(u *SignatureSet) bool
func (*SignatureSet) IsValid ¶
func (v *SignatureSet) IsValid() error
func (*SignatureSet) MarshalBinary ¶
func (v *SignatureSet) MarshalBinary() ([]byte, error)
func (*SignatureSet) MarshalJSON ¶
func (v *SignatureSet) MarshalJSON() ([]byte, error)
func (*SignatureSet) UnmarshalBinary ¶
func (v *SignatureSet) UnmarshalBinary(data []byte) error
func (*SignatureSet) UnmarshalBinaryFrom ¶
func (v *SignatureSet) UnmarshalBinaryFrom(rd io.Reader) error
func (*SignatureSet) UnmarshalJSON ¶
func (v *SignatureSet) UnmarshalJSON(data []byte) error
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction manages a transaction.
func (*Transaction) AddSyntheticTxns ¶
func (t *Transaction) AddSyntheticTxns(txids ...[32]byte) error
AddSyntheticTxns is a convenience method that calls GetSyntheticTxns, adds the IDs, and calls PutSyntheticTxns.
func (*Transaction) Get ¶
func (t *Transaction) Get() (*protocol.Envelope, *protocol.TransactionStatus, []protocol.Signature, error)
Get loads the transaction state, status, and signatures.
See GetState, GetStatus, and GetSignatures.
func (*Transaction) GetSignatures ¶
func (t *Transaction) GetSignatures() (*SignatureSet, error)
GetSignatures loads the transaction's signatures.
func (*Transaction) GetState ¶
func (t *Transaction) GetState() (*protocol.Envelope, error)
GetState loads the transaction state.
func (*Transaction) GetStatus ¶
func (t *Transaction) GetStatus() (*protocol.TransactionStatus, error)
GetStatus loads the transaction status.
func (*Transaction) GetSyntheticTxns ¶
func (t *Transaction) GetSyntheticTxns() (*protocol.HashSet, error)
GetSyntheticTxns loads the IDs of synthetic transactions produced by the transaction.
func (*Transaction) Index ¶
func (t *Transaction) Index(key ...interface{}) *Value
Index returns a value that can read or write an index value.
func (*Transaction) Put ¶
func (t *Transaction) Put(state *protocol.Envelope, status *protocol.TransactionStatus, sigs []protocol.Signature) error
Put stores the transaction object metadata, state, status, and signatures. Put appends signatures and does not overwrite existing signatures.
See PutState, PutStatus, and AddSignatures.
func (*Transaction) PutSignatures ¶
func (t *Transaction) PutSignatures(v *SignatureSet) error
PutSignatures stores the transaction's signatures.
func (*Transaction) PutState ¶
func (t *Transaction) PutState(v *protocol.Envelope) error
PutState stores the transaction state.
func (*Transaction) PutStatus ¶
func (t *Transaction) PutStatus(v *protocol.TransactionStatus) error
PutStatus stores the transaction status.
func (*Transaction) PutSyntheticTxns ¶ added in v0.5.1
func (t *Transaction) PutSyntheticTxns(v *protocol.HashSet) error
PutSyntheticTxns stores the IDs of synthetic transactions produced by the transaction.
type TypedValue ¶ added in v0.5.1
type TypedValue interface { encoding.BinaryMarshaler CopyAsInterface() interface{} }
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value reads and writes a value.
type ValueUnmarshalFunc ¶ added in v0.5.1
type ValueUnmarshalFunc func([]byte) (TypedValue, error)