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() (state.Chain, error)
- func (r *Account) GetStateAs(state state.Chain) 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(accountState state.Chain) error
- func (r *Account) ReadChain(name string) (*Chain, error)
- func (r *Account) ReadIndexChain(name string, major bool) (*Chain, error)
- type Batch
- func (b *Batch) Account(u *url.URL) *Account
- func (b *Batch) AccountByID(id []byte) *Accountdeprecated
- func (b *Batch) BptRootHash() []byte
- func (b *Batch) Commit() error
- func (b *Batch) Discard()
- func (b *Batch) GetMinorRootChainAnchor(network *config.Network) ([]byte, error)
- func (b *Batch) Import(db interface{ ... })
- func (b *Batch) Transaction(id []byte) *Transaction
- func (b *Batch) UpdateBpt()
- type Chain
- func (c *Chain) AddEntry(entry []byte, unique bool) error
- func (c *Chain) Anchor() []byte
- 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 Transaction
- func (t *Transaction) AddSignatures(newSignatures ...protocol.Signature) (count int, err error)
- func (t *Transaction) AddSyntheticTxns(txids ...[32]byte) error
- func (t *Transaction) Get() (*state.Transaction, *protocol.TransactionStatus, []protocol.Signature, error)
- func (t *Transaction) GetSignatures() ([]protocol.Signature, error)
- func (t *Transaction) GetState() (*state.Transaction, error)
- func (t *Transaction) GetStatus() (*protocol.TransactionStatus, error)
- func (t *Transaction) GetSyntheticTxns() ([][32]byte, error)
- func (t *Transaction) Index(key ...interface{}) *Value
- func (t *Transaction) Put(state *state.Transaction, status *protocol.TransactionStatus, ...) error
- func (t *Transaction) PutState(state *state.Transaction) error
- func (t *Transaction) PutStatus(status *protocol.TransactionStatus) error
- type Value
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.
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).
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch batches database writes.
func (*Batch) AccountByID
deprecated
func (*Batch) BptRootHash ¶
BptRootHash returns the root hash of the BPT.
func (*Batch) Commit ¶
Commit commits pending writes to the key-value store. Attempting to use the Batch after calling Commit will result in a panic.
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) 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 Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction manages a transaction.
func (*Transaction) AddSignatures ¶
func (t *Transaction) AddSignatures(newSignatures ...protocol.Signature) (count int, err error)
AddSignatures adds signatures the transaction's list of signatures.
func (*Transaction) AddSyntheticTxns ¶
func (t *Transaction) AddSyntheticTxns(txids ...[32]byte) error
AddSyntheticTxns adds the given IDs to the list of synthetic transactions produced by the transaction.
func (*Transaction) Get ¶
func (t *Transaction) Get() (*state.Transaction, *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() ([]protocol.Signature, error)
GetSignatures loads the transaction's signatures.
func (*Transaction) GetState ¶
func (t *Transaction) GetState() (*state.Transaction, error)
GetState loads the transaction state.
func (*Transaction) GetStatus ¶
func (t *Transaction) GetStatus() (*protocol.TransactionStatus, error)
GetStatus loads the transaction state.
func (*Transaction) GetSyntheticTxns ¶
func (t *Transaction) GetSyntheticTxns() ([][32]byte, error)
GetSyntheticTxns returns 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 *state.Transaction, 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) PutState ¶
func (t *Transaction) PutState(state *state.Transaction) error
PutState stores the transaction state and adds the transaction to the BPT (as a hash).
func (*Transaction) PutStatus ¶
func (t *Transaction) PutStatus(status *protocol.TransactionStatus) error
PutStatus stores the transaction state.