ipfs

package
v0.0.0-...-488aebd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

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

func UnixTimePrefixedRandomNonce(size int) []byte

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 Config

type Config struct {
	HotCacheSize       int64
	EndPointConnection string
}

type DB

type DB struct {
	// contains filtered or unexported fields
}

func (*DB) Close

func (db *DB) Close() error

func (*DB) Compact

func (db *DB) Compact() error

func (*DB) Delete

func (db *DB) Delete(key []byte) error

func (*DB) Get

func (db *DB) Get(key []byte) ([]byte, error)

func (*DB) GetStorageEngine

func (s *DB) GetStorageEngine() interface{}

func (*DB) Metrics

func (db *DB) Metrics() (tit string, metrics []map[string]interface{})

func (*DB) NewIterator

func (db *DB) NewIterator() driver.IIterator

func (*DB) NewSnapshot

func (db *DB) NewSnapshot() (driver.ISnapshot, error)

func (*DB) NewWriteBatch

func (db *DB) NewWriteBatch() driver.IWriteBatch

func (*DB) Put

func (db *DB) Put(key, value []byte) error

func (*DB) SyncDelete

func (db *DB) SyncDelete(key []byte) error

func (*DB) SyncPut

func (db *DB) SyncPut(key []byte, value []byte) error

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

func (*Iterator) Close

func (it *Iterator) Close() error

func (*Iterator) First

func (it *Iterator) First()

func (*Iterator) Key

func (it *Iterator) Key() []byte

func (*Iterator) Last

func (it *Iterator) Last()

func (*Iterator) Next

func (it *Iterator) Next()

func (*Iterator) Prev

func (it *Iterator) Prev()

func (*Iterator) Seek

func (it *Iterator) Seek(key []byte)

func (*Iterator) Valid

func (it *Iterator) Valid() bool

func (*Iterator) Value

func (it *Iterator) Value() []byte

func (*Iterator) Value1

func (it *Iterator) Value1() []byte

type Snapshot

type Snapshot struct {
	// contains filtered or unexported fields
}

func (*Snapshot) Close

func (s *Snapshot) Close()

func (*Snapshot) Get

func (s *Snapshot) Get(key []byte) ([]byte, error)

func (*Snapshot) NewIterator

func (s *Snapshot) NewIterator() driver.IIterator

type Store

type Store struct{}

func (Store) Open

func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error)

func (Store) Repair

func (s Store) Repair(path string, cfg *config.Config) error

func (Store) String

func (s Store) String() string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL