Documentation ¶
Index ¶
- type Batch
- type DB
- type GoLevelDB
- func (db *GoLevelDB) Close()
- func (db *GoLevelDB) DB() *leveldb.DB
- func (db *GoLevelDB) Delete(key []byte)
- func (db *GoLevelDB) DeleteSync(key []byte)
- func (db *GoLevelDB) Get(key []byte) []byte
- func (db *GoLevelDB) Has(key []byte) bool
- func (db *GoLevelDB) Iterator(start, end []byte) Iterator
- func (db *GoLevelDB) NewBatch() Batch
- func (db *GoLevelDB) Print()
- func (db *GoLevelDB) ReverseIterator(start, end []byte) Iterator
- func (db *GoLevelDB) Set(key []byte, value []byte)
- func (db *GoLevelDB) SetSync(key []byte, value []byte)
- func (db *GoLevelDB) Stats() map[string]string
- type Iterator
- type KeygenStarted
- type SetDeleter
- type SqliteDB
- type TorusLDB
- func (t *TorusLDB) GetKeygenStarted(keygenID string) bool
- func (t *TorusLDB) GetShareCount() int
- func (t *TorusLDB) RetrieveCommitmentMatrix(keyIndex big.Int) ([][]common.Point, error)
- func (t *TorusLDB) RetrieveCompletedShare(keyIndex big.Int) (*big.Int, *big.Int, error)
- func (t *TorusLDB) RetrieveKEYGENSecret(keyIndex big.Int) (*keygen.KEYGENSecrets, error)
- func (t *TorusLDB) RetrieveKeyIndexToPublicKey(keyIndex big.Int) (*common.Point, error)
- func (t *TorusLDB) RetrievePublicKeyToKeyIndex(publicKey common.Point) (*big.Int, error)
- func (t *TorusLDB) SetKeygenStarted(keygenID string, started bool)
- func (t *TorusLDB) StoreCommitmentMatrix(keyIndex big.Int, c [][]common.Point) error
- func (t *TorusLDB) StoreCompletedShare(keyIndex big.Int, si big.Int, siprime big.Int) error
- func (t *TorusLDB) StoreKEYGENSecret(keyIndex big.Int, secret keygen.KEYGENSecrets) error
- func (t *TorusLDB) StorePublicKeyToKeyIndex(publicKey common.Point, keyIndex big.Int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch interface { SetDeleter Write() WriteSync() }
type DB ¶
type DB interface { // Get returns nil iff key doesn't exist. // A nil key is interpreted as an empty byteslice. // CONTRACT: key, value readonly []byte Get([]byte) []byte // Has checks if a key exists. // A nil key is interpreted as an empty byteslice. // CONTRACT: key, value readonly []byte Has(key []byte) bool // Set sets the key. // A nil key is interpreted as an empty byteslice. // CONTRACT: key, value readonly []byte Set([]byte, []byte) SetSync([]byte, []byte) // Delete deletes the key. // A nil key is interpreted as an empty byteslice. // CONTRACT: key readonly []byte Delete([]byte) DeleteSync([]byte) // Iterate over a domain of keys in ascending order. End is exclusive. // Start must be less than end, or the Iterator is invalid. // A nil start is interpreted as an empty byteslice. // If end is nil, iterates up to the last item (inclusive). // CONTRACT: No writes may happen within a domain while an iterator exists over it. // CONTRACT: start, end readonly []byte Iterator(start, end []byte) Iterator // Iterate over a domain of keys in descending order. End is exclusive. // Start must be greater than end, or the Iterator is invalid. // If start is nil, iterates from the last/greatest item (inclusive). // If end is nil, iterates up to the first/least item (inclusive). // CONTRACT: No writes may happen within a domain while an iterator exists over it. // CONTRACT: start, end readonly []byte ReverseIterator(start, end []byte) Iterator // Closes the connection. Close() // Creates a batch for atomic updates. NewBatch() Batch // For debugging Print() // Stats returns a map of property values for all keys and the size of the cache. Stats() map[string]string }
DBs are goroutine safe.
type GoLevelDB ¶
type GoLevelDB struct {
// contains filtered or unexported fields
}
func NewGoLevelDB ¶
func NewGoLevelDBWithOpts ¶
func (*GoLevelDB) ReverseIterator ¶
Implements DB.
type Iterator ¶
type Iterator interface { // The start & end (exclusive) limits to iterate over. // If end < start, then the Iterator goes in reverse order. // // A domain of ([]byte{12, 13}, []byte{12, 14}) will iterate // over anything with the prefix []byte{12, 13}. // // The smallest key is the empty byte array []byte{} - see BeginningKey(). // The largest key is the nil byte array []byte(nil) - see EndingKey(). // CONTRACT: start, end readonly []byte Domain() (start []byte, end []byte) // Valid returns whether the current position is valid. // Once invalid, an Iterator is forever invalid. Valid() bool // Next moves the iterator to the next sequential key in the database, as // defined by order of iteration. // // If Valid returns false, this method will panic. Next() // Key returns the key of the cursor. // If Valid returns false, this method will panic. // CONTRACT: key readonly []byte Key() (key []byte) // Value returns the value of the cursor. // If Valid returns false, this method will panic. // CONTRACT: value readonly []byte Value() (value []byte) // Close releases the Iterator. Close() }
Usage:
var itr Iterator = ... defer itr.Close()
for ; itr.Valid(); itr.Next() { k, v := itr.Key(); itr.Value() // ... }
type KeygenStarted ¶
type KeygenStarted struct {
Started bool
}
type SetDeleter ¶
type SqliteDB ¶
type SqliteDB struct {
// contains filtered or unexported fields
}
Store represents persistent customer and event storage.
type TorusLDB ¶
type TorusLDB struct {
// contains filtered or unexported fields
}
TorusLDB implements TorusDB on top of LevelDB
func NewTorusLDB ¶
NewTorusLDB returns a leveldb implementation of TorusDB NOTE: dbDirPath MUST be a directory
func (*TorusLDB) GetKeygenStarted ¶
func (*TorusLDB) GetShareCount ¶
func (*TorusLDB) RetrieveCommitmentMatrix ¶
func (*TorusLDB) RetrieveCompletedShare ¶
func (*TorusLDB) RetrieveKEYGENSecret ¶
func (*TorusLDB) RetrieveKeyIndexToPublicKey ¶
func (*TorusLDB) RetrievePublicKeyToKeyIndex ¶
func (*TorusLDB) SetKeygenStarted ¶
func (*TorusLDB) StoreCommitmentMatrix ¶
func (*TorusLDB) StoreCompletedShare ¶
func (*TorusLDB) StoreKEYGENSecret ¶
Click to show internal directories.
Click to hide internal directories.