Documentation ¶
Index ¶
- Constants
- Variables
- func UnixTimePrefixedRandomNonce(size int) []byte
- type Config
- type DB
- func (db *DB) Close() error
- func (db *DB) Compact() error
- func (db *DB) Delete(key []byte) error
- func (db *DB) Get(key []byte) ([]byte, error)
- func (s *DB) GetStorageEngine() interface{}
- func (db *DB) Metrics() (tit string, metrics []map[string]interface{})
- func (db *DB) NewIterator() driver.IIterator
- func (db *DB) NewSnapshot() (driver.ISnapshot, error)
- func (db *DB) NewWriteBatch() driver.IWriteBatch
- func (db *DB) Put(key, value []byte) error
- func (db *DB) SyncDelete(key []byte) error
- func (db *DB) SyncPut(key []byte, value []byte) error
- type Iterator
- func (it *Iterator) Close() error
- func (it *Iterator) First()
- func (it *Iterator) Key() []byte
- func (it *Iterator) Last()
- func (it *Iterator) Next()
- func (it *Iterator) Prev()
- func (it *Iterator) Seek(key []byte)
- func (it *Iterator) Valid() bool
- func (it *Iterator) Value() []byte
- func (it *Iterator) Value1() []byte
- type Snapshot
- type Store
- type WriteBatch
Constants ¶
View Source
const ( StorageName = "ipfs" MB int64 = 1024 * 1024 )
Variables ¶
View Source
var IpfsDefaultConfig = Config{
HotCacheSize: defaultHotCacheSize,
EndPointConnection: "http://localhost:5001",
}
Functions ¶
func UnixTimePrefixedRandomNonce ¶
UnixTimePrefixedRandomNonce takes an int for the nonce size and returns a byte slice of length size. A byte slice is created for the nonce and filled with random data from `crypto/rand`, then the first 4 bytes of the nonce are overwritten with LittleEndian encoding of `time.Now().Unix()` The purpose of this function is to avoid an unlikely collision in randomly generating nonces by prefixing the nonce with time series data.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) GetStorageEngine ¶
func (s *DB) GetStorageEngine() interface{}
func (*DB) NewIterator ¶
func (*DB) NewWriteBatch ¶
func (db *DB) NewWriteBatch() driver.IWriteBatch
func (*DB) SyncDelete ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
func (*Snapshot) NewIterator ¶
type WriteBatch ¶
type WriteBatch struct {
// contains filtered or unexported fields
}
func (*WriteBatch) Close ¶
func (w *WriteBatch) Close()
func (*WriteBatch) Commit ¶
func (w *WriteBatch) Commit() error
func (*WriteBatch) Data ¶
func (w *WriteBatch) Data() []byte
func (*WriteBatch) Delete ¶
func (w *WriteBatch) Delete(key []byte)
func (*WriteBatch) Put ¶
func (w *WriteBatch) Put(key, value []byte)
func (*WriteBatch) Rollback ¶
func (w *WriteBatch) Rollback() error
func (*WriteBatch) SyncCommit ¶
func (w *WriteBatch) SyncCommit() error
Click to show internal directories.
Click to hide internal directories.