Documentation ¶
Overview ¶
Copyright 2019 The XDPoSChain Authors This file is part of the Core XDPoSChain infrastructure https://XDPoSChain.com Package XDCxDAO provides an interface to work with XDCx database, including leveldb for masternode and mongodb for SDK node
Index ¶
- func EmptyKey() []byte
- type Batch
- type BatchDatabase
- func (db *BatchDatabase) Ancient(kind string, number uint64) ([]byte, error)
- func (db *BatchDatabase) AncientSize(kind string) (uint64, error)
- func (db *BatchDatabase) Ancients() (uint64, error)
- func (db *BatchDatabase) AppendAncient(number uint64, hash, header, body, receipts, td []byte) error
- func (db *BatchDatabase) Close() error
- func (db *BatchDatabase) CommitBulk() error
- func (db *BatchDatabase) CommitLendingBulk() error
- func (db *BatchDatabase) Compact(start []byte, limit []byte) error
- func (db *BatchDatabase) Delete(key []byte) error
- func (db *BatchDatabase) DeleteItemByTxHash(txhash common.Hash, val interface{})
- func (db *BatchDatabase) DeleteObject(hash common.Hash, val interface{}) error
- func (db *BatchDatabase) Get(key []byte) ([]byte, error)
- func (db *BatchDatabase) GetListItemByHashes(hashes []string, val interface{}) interface{}
- func (db *BatchDatabase) GetListItemByTxHash(txhash common.Hash, val interface{}) interface{}
- func (db *BatchDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error)
- func (db *BatchDatabase) Has(key []byte) (bool, error)
- func (db *BatchDatabase) HasAncient(kind string, number uint64) (bool, error)
- func (db *BatchDatabase) HasObject(hash common.Hash, val interface{}) (bool, error)
- func (db *BatchDatabase) InitBulk()
- func (db *BatchDatabase) InitLendingBulk()
- func (db *BatchDatabase) IsEmptyKey(key []byte) bool
- func (db *BatchDatabase) NewBatch() ethdb.Batch
- func (db *BatchDatabase) NewIterator(prefix []byte, start []byte) ethdb.Iterator
- func (db *BatchDatabase) Put(key []byte, val []byte) error
- func (db *BatchDatabase) PutObject(hash common.Hash, val interface{}) error
- func (db *BatchDatabase) Stat(property string) (string, error)
- func (db *BatchDatabase) Sync() error
- func (db *BatchDatabase) TruncateAncients(items uint64) error
- type BatchItem
- type MongoDatabase
- func (db *MongoDatabase) Ancient(kind string, number uint64) ([]byte, error)
- func (db *MongoDatabase) AncientSize(kind string) (uint64, error)
- func (db *MongoDatabase) Ancients() (uint64, error)
- func (db *MongoDatabase) AppendAncient(number uint64, hash, header, body, receipts, td []byte) error
- func (db *MongoDatabase) Close() error
- func (db *MongoDatabase) CommitBulk() error
- func (db *MongoDatabase) CommitLendingBulk() error
- func (db *MongoDatabase) Compact(start []byte, limit []byte) error
- func (db *MongoDatabase) Delete(key []byte) error
- func (db *MongoDatabase) DeleteItemByTxHash(txhash common.Hash, val interface{})
- func (db *MongoDatabase) DeleteObject(hash common.Hash, val interface{}) error
- func (db *MongoDatabase) EnsureIndexes() error
- func (db *MongoDatabase) Get(key []byte) ([]byte, error)
- func (db *MongoDatabase) GetListItemByHashes(hashes []string, val interface{}) interface{}
- func (db *MongoDatabase) GetListItemByTxHash(txhash common.Hash, val interface{}) interface{}
- func (db *MongoDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error)
- func (db *MongoDatabase) Has(key []byte) (bool, error)
- func (db *MongoDatabase) HasAncient(kind string, number uint64) (bool, error)
- func (db *MongoDatabase) HasObject(hash common.Hash, val interface{}) (bool, error)
- func (db *MongoDatabase) InitBulk()
- func (db *MongoDatabase) InitLendingBulk()
- func (db *MongoDatabase) IsEmptyKey(key []byte) bool
- func (db *MongoDatabase) NewBatch() ethdb.Batch
- func (db *MongoDatabase) NewIterator(prefix []byte, start []byte) ethdb.Iterator
- func (db *MongoDatabase) Put(key []byte, val []byte) error
- func (db *MongoDatabase) PutObject(hash common.Hash, val interface{}) error
- func (db *MongoDatabase) Stat(property string) (string, error)
- func (db *MongoDatabase) Sync() error
- func (db *MongoDatabase) TruncateAncients(items uint64) error
- type XDCXDAO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
func (*Batch) SetCollection ¶
type BatchDatabase ¶
type BatchDatabase struct { Debug bool // contains filtered or unexported fields }
func NewBatchDatabase ¶
func NewBatchDatabase(datadir string, cacheLimit int) *BatchDatabase
NewBatchDatabase use rlp as encoding
func NewBatchDatabaseWithEncode ¶
func NewBatchDatabaseWithEncode(datadir string, cacheLimit int) *BatchDatabase
batchdatabase is a fast cache db to retrieve in-mem object
func (*BatchDatabase) Ancient ¶
func (db *BatchDatabase) Ancient(kind string, number uint64) ([]byte, error)
Ancient returns an error as we don't have a backing chain freezer.
func (*BatchDatabase) AncientSize ¶
func (db *BatchDatabase) AncientSize(kind string) (uint64, error)
AncientSize returns an error as we don't have a backing chain freezer.
func (*BatchDatabase) Ancients ¶
func (db *BatchDatabase) Ancients() (uint64, error)
Ancients returns an error as we don't have a backing chain freezer.
func (*BatchDatabase) AppendAncient ¶
func (db *BatchDatabase) AppendAncient(number uint64, hash, header, body, receipts, td []byte) error
AppendAncient returns an error as we don't have a backing chain freezer.
func (*BatchDatabase) Close ¶
func (db *BatchDatabase) Close() error
func (*BatchDatabase) CommitBulk ¶
func (db *BatchDatabase) CommitBulk() error
func (*BatchDatabase) CommitLendingBulk ¶
func (db *BatchDatabase) CommitLendingBulk() error
func (*BatchDatabase) Delete ¶
func (db *BatchDatabase) Delete(key []byte) error
func (*BatchDatabase) DeleteItemByTxHash ¶
func (db *BatchDatabase) DeleteItemByTxHash(txhash common.Hash, val interface{})
func (*BatchDatabase) DeleteObject ¶
func (db *BatchDatabase) DeleteObject(hash common.Hash, val interface{}) error
func (*BatchDatabase) GetListItemByHashes ¶
func (db *BatchDatabase) GetListItemByHashes(hashes []string, val interface{}) interface{}
func (*BatchDatabase) GetListItemByTxHash ¶
func (db *BatchDatabase) GetListItemByTxHash(txhash common.Hash, val interface{}) interface{}
func (*BatchDatabase) GetObject ¶
func (db *BatchDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error)
func (*BatchDatabase) HasAncient ¶
func (db *BatchDatabase) HasAncient(kind string, number uint64) (bool, error)
HasAncient returns an error as we don't have a backing chain freezer.
func (*BatchDatabase) HasObject ¶
func (db *BatchDatabase) HasObject(hash common.Hash, val interface{}) (bool, error)
func (*BatchDatabase) InitBulk ¶
func (db *BatchDatabase) InitBulk()
func (*BatchDatabase) InitLendingBulk ¶
func (db *BatchDatabase) InitLendingBulk()
func (*BatchDatabase) IsEmptyKey ¶
func (db *BatchDatabase) IsEmptyKey(key []byte) bool
func (*BatchDatabase) NewBatch ¶
func (db *BatchDatabase) NewBatch() ethdb.Batch
func (*BatchDatabase) NewIterator ¶
func (db *BatchDatabase) NewIterator(prefix []byte, start []byte) ethdb.Iterator
func (*BatchDatabase) PutObject ¶
func (db *BatchDatabase) PutObject(hash common.Hash, val interface{}) error
func (*BatchDatabase) Sync ¶
func (db *BatchDatabase) Sync() error
Sync returns an error as we don't have a backing chain freezer.
func (*BatchDatabase) TruncateAncients ¶
func (db *BatchDatabase) TruncateAncients(items uint64) error
TruncateAncients returns an error as we don't have a backing chain freezer.
type MongoDatabase ¶
func NewMongoDatabase ¶
func NewMongoDatabase(session *mgo.Session, dbName string, mongoURL string, replicaSetName string, cacheLimit int) (*MongoDatabase, error)
InitSession initializes a new session with mongodb
func (*MongoDatabase) Ancient ¶
func (db *MongoDatabase) Ancient(kind string, number uint64) ([]byte, error)
Ancient returns an error as we don't have a backing chain freezer.
func (*MongoDatabase) AncientSize ¶
func (db *MongoDatabase) AncientSize(kind string) (uint64, error)
AncientSize returns an error as we don't have a backing chain freezer.
func (*MongoDatabase) Ancients ¶
func (db *MongoDatabase) Ancients() (uint64, error)
Ancients returns an error as we don't have a backing chain freezer.
func (*MongoDatabase) AppendAncient ¶
func (db *MongoDatabase) AppendAncient(number uint64, hash, header, body, receipts, td []byte) error
AppendAncient returns an error as we don't have a backing chain freezer.
func (*MongoDatabase) Close ¶
func (db *MongoDatabase) Close() error
func (*MongoDatabase) CommitBulk ¶
func (db *MongoDatabase) CommitBulk() error
func (*MongoDatabase) CommitLendingBulk ¶
func (db *MongoDatabase) CommitLendingBulk() error
func (*MongoDatabase) Delete ¶
func (db *MongoDatabase) Delete(key []byte) error
func (*MongoDatabase) DeleteItemByTxHash ¶
func (db *MongoDatabase) DeleteItemByTxHash(txhash common.Hash, val interface{})
func (*MongoDatabase) DeleteObject ¶
func (db *MongoDatabase) DeleteObject(hash common.Hash, val interface{}) error
func (*MongoDatabase) EnsureIndexes ¶
func (db *MongoDatabase) EnsureIndexes() error
func (*MongoDatabase) GetListItemByHashes ¶
func (db *MongoDatabase) GetListItemByHashes(hashes []string, val interface{}) interface{}
func (*MongoDatabase) GetListItemByTxHash ¶
func (db *MongoDatabase) GetListItemByTxHash(txhash common.Hash, val interface{}) interface{}
func (*MongoDatabase) GetObject ¶
func (db *MongoDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error)
func (*MongoDatabase) HasAncient ¶
func (db *MongoDatabase) HasAncient(kind string, number uint64) (bool, error)
HasAncient returns an error as we don't have a backing chain freezer.
func (*MongoDatabase) HasObject ¶
func (db *MongoDatabase) HasObject(hash common.Hash, val interface{}) (bool, error)
func (*MongoDatabase) InitBulk ¶
func (db *MongoDatabase) InitBulk()
func (*MongoDatabase) InitLendingBulk ¶
func (db *MongoDatabase) InitLendingBulk()
func (*MongoDatabase) IsEmptyKey ¶
func (db *MongoDatabase) IsEmptyKey(key []byte) bool
func (*MongoDatabase) NewBatch ¶
func (db *MongoDatabase) NewBatch() ethdb.Batch
func (*MongoDatabase) NewIterator ¶
func (db *MongoDatabase) NewIterator(prefix []byte, start []byte) ethdb.Iterator
func (*MongoDatabase) PutObject ¶
func (db *MongoDatabase) PutObject(hash common.Hash, val interface{}) error
func (*MongoDatabase) Sync ¶
func (db *MongoDatabase) Sync() error
Sync returns an error as we don't have a backing chain freezer.
func (*MongoDatabase) TruncateAncients ¶
func (db *MongoDatabase) TruncateAncients(items uint64) error
TruncateAncients returns an error as we don't have a backing chain freezer.
type XDCXDAO ¶
type XDCXDAO interface { // for both leveldb and mongodb IsEmptyKey(key []byte) bool Close() error // mongodb methods HasObject(hash common.Hash, val interface{}) (bool, error) GetObject(hash common.Hash, val interface{}) (interface{}, error) PutObject(hash common.Hash, val interface{}) error DeleteObject(hash common.Hash, val interface{}) error // won't return error if key not found GetListItemByTxHash(txhash common.Hash, val interface{}) interface{} GetListItemByHashes(hashes []string, val interface{}) interface{} DeleteItemByTxHash(txhash common.Hash, val interface{}) // basic XDCx InitBulk() CommitBulk() error // XDCx lending InitLendingBulk() CommitLendingBulk() error // leveldb methods Put(key []byte, value []byte) error Get(key []byte) ([]byte, error) Has(key []byte) (bool, error) Delete(key []byte) error NewBatch() ethdb.Batch HasAncient(kind string, number uint64) (bool, error) Ancient(kind string, number uint64) ([]byte, error) Ancients() (uint64, error) AncientSize(kind string) (uint64, error) AppendAncient(number uint64, hash, header, body, receipt, td []byte) error TruncateAncients(n uint64) error Sync() error NewIterator(prefix []byte, start []byte) ethdb.Iterator Stat(property string) (string, error) Compact(start []byte, limit []byte) error }