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.Object, 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() error
- 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) StateReceipt() (*managed.Receipt, 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(writable bool) *Batch
- func (b *Batch) BptReceipt(key storage.Key, value [32]byte) (*managed.Receipt, error)
- func (b *Batch) Commit() error
- func (b *Batch) CommitBpt() ([]byte, error)
- func (b *Batch) Discard()
- func (b *Batch) ExampleGetFullState(key storage.Key) ([]byte, error)
- func (b *Batch) GetMinorRootChainAnchor(network *config.Network) ([]byte, error)
- func (b *Batch) Import(db interface{ ... }) error
- func (b *Batch) Transaction(id []byte) *Transaction
- func (b *Batch) Update(fn func(*Batch) error) error
- func (b *Batch) View(fn func(*Batch) error) error
- type Chain
- func (c *Chain) AddEntry(entry []byte, unique bool) error
- func (c *Chain) Anchor() []byte
- func (c *Chain) AnchorAt(height uint64) ([]byte, error)
- 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 SigOrTxn
- func (v *SigOrTxn) Copy() *SigOrTxn
- func (v *SigOrTxn) CopyAsInterface() interface{}
- func (v *SigOrTxn) Equal(u *SigOrTxn) bool
- func (v *SigOrTxn) IsValid() error
- func (v *SigOrTxn) MarshalBinary() ([]byte, error)
- func (v *SigOrTxn) MarshalJSON() ([]byte, error)
- func (v *SigOrTxn) UnmarshalBinary(data []byte) error
- func (v *SigOrTxn) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *SigOrTxn) UnmarshalJSON(data []byte) error
- type SignatureSet
- type Transaction
- func (t *Transaction) AddSignature(newSignature protocol.Signature) (int, error)
- func (t *Transaction) AddSyntheticTxns(txids ...[32]byte) error
- func (t *Transaction) GetState() (*SigOrTxn, 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) PutState(v *SigOrTxn) error
- func (t *Transaction) PutStatus(v *protocol.TransactionStatus) error
- func (t *Transaction) PutSyntheticTxns(v *protocol.HashSet) error
- func (t *Transaction) ReadSignatures(signer *url.URL) (*SignatureSet, error)
- func (t *Transaction) ReadSignaturesForSigner(signer protocol.Signer) (*SignatureSet, error)
- func (t *Transaction) Signatures(signer *url.URL) (*SignatureSet, error)
- func (t *Transaction) SignaturesForSigner(signer protocol.Signer) (*SignatureSet, 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) 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) BptReceipt ¶ added in v0.5.1
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) ExampleGetFullState ¶ added in v0.6.0
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) AnchorAt ¶ added in v0.5.1
AnchorAt calculates the anchor of the chain at the given height.
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 SigOrTxn ¶ added in v0.6.0
type SigOrTxn struct { Transaction *protocol.Transaction `json:"transaction,omitempty" form:"transaction" query:"transaction" validate:"required"` Signature protocol.Signature `json:"signature,omitempty" form:"signature" query:"signature" validate:"required"` Hash [32]byte `json:"hash,omitempty" form:"hash" query:"hash" validate:"required"` // contains filtered or unexported fields }
func (*SigOrTxn) CopyAsInterface ¶ added in v0.6.0
func (v *SigOrTxn) CopyAsInterface() interface{}
func (*SigOrTxn) MarshalBinary ¶ added in v0.6.0
func (*SigOrTxn) MarshalJSON ¶ added in v0.6.0
func (*SigOrTxn) UnmarshalBinary ¶ added in v0.6.0
func (*SigOrTxn) UnmarshalBinaryFrom ¶ added in v0.6.0
func (*SigOrTxn) UnmarshalJSON ¶ added in v0.6.0
type SignatureSet ¶ added in v0.5.1
type SignatureSet struct {
// contains filtered or unexported fields
}
func (*SignatureSet) Add ¶ added in v0.5.1
func (s *SignatureSet) Add(newSignature protocol.Signature) (int, error)
Add adds a signature to the signature set. Add does nothing if the signature set already includes the signer's public key. The entry hash must refer to a signature chain entry.
func (*SignatureSet) Count ¶ added in v0.5.1
func (s *SignatureSet) Count() int
func (*SignatureSet) EntryHashes ¶ added in v0.5.1
func (s *SignatureSet) EntryHashes() [][32]byte
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction manages a transaction.
func (*Transaction) AddSignature ¶ added in v0.5.1
func (t *Transaction) AddSignature(newSignature protocol.Signature) (int, error)
AddSignature loads the appropriate siganture set and adds the signature to it.
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) GetState ¶
func (t *Transaction) GetState() (*SigOrTxn, 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) PutState ¶
func (t *Transaction) PutState(v *SigOrTxn) 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.
func (*Transaction) ReadSignatures ¶ added in v0.5.1
func (t *Transaction) ReadSignatures(signer *url.URL) (*SignatureSet, error)
ReadSignatures returns a read-only signature set for the given signer.
func (*Transaction) ReadSignaturesForSigner ¶ added in v0.6.0
func (t *Transaction) ReadSignaturesForSigner(signer protocol.Signer) (*SignatureSet, error)
SignaturesForSigner returns a read-only signature set for the given signer account.
func (*Transaction) Signatures ¶ added in v0.5.1
func (t *Transaction) Signatures(signer *url.URL) (*SignatureSet, error)
Signatures returns a signature set for the given signer.
func (*Transaction) SignaturesForSigner ¶ added in v0.6.0
func (t *Transaction) SignaturesForSigner(signer protocol.Signer) (*SignatureSet, error)
SignaturesForSigner returns a signature set for the given signer account.
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)