Documentation ¶
Overview ¶
Package storage provides storage for chestnut.
Package storage provides storage for chestnut.
Package storage provides storage for chestnut.
Index ¶
- Constants
- Variables
- type CSBadger
- func (s *CSBadger) BatchWrite(keys [][]byte, values [][]byte) error
- func (s *CSBadger) Close() error
- func (s *CSBadger) Delete(key []byte) error
- func (s *CSBadger) Foreach(fn func([]byte, []byte, error) error) error
- func (s *CSBadger) Get(key []byte) ([]byte, error)
- func (s *CSBadger) GetSequence(key []byte, bandwidth uint64) (Sequence, error)
- func (s *CSBadger) Init(path string) error
- func (s *CSBadger) IsExist(key []byte) (bool, error)
- func (s *CSBadger) PrefixForeach(prefix []byte, fn func([]byte, []byte, error) error) error
- func (s *CSBadger) PrefixForeachKey(prefix []byte, valid []byte, reverse bool, fn func([]byte, error) error) error
- func (s *CSBadger) Set(key []byte, val []byte) error
- type ChestnutStorage
- type DbMgr
- func (dbMgr *DbMgr) AddBlock(newBlock *chestnutpb.Block, cached bool, prefix ...string) error
- func (dbMgr *DbMgr) AddGensisBlock(gensisBlock *chestnutpb.Block, prefix ...string) error
- func (dbMgr *DbMgr) AddGroup(groupItem *chestnutpb.GroupItem) error
- func (dbMgr *DbMgr) AddPost(trx *chestnutpb.Trx, prefix ...string) error
- func (dbMgr *DbMgr) AddProducedBlockCount(groupId, producerPubkey string, prefix ...string) error
- func (dbMgr *DbMgr) AddProducer(item *chestnutpb.ProducerItem, prefix ...string) error
- func (dbMgr *DbMgr) AddTrx(trx *chestnutpb.Trx, prefix ...string) error
- func (dbMgr *DbMgr) CloseDb()
- func (dbMgr *DbMgr) GatherBlocksFromCache(newBlock *chestnutpb.Block, cached bool, prefix ...string) ([]*chestnutpb.Block, error)
- func (dbMgr *DbMgr) GetAllSchemasByGroup(groupId string, prefix ...string) ([]*chestnutpb.SchemaItem, error)
- func (dbMgr *DbMgr) GetAnnounceProducersByGroup(groupId string, prefix ...string) ([]*chestnutpb.AnnounceItem, error)
- func (dbMgr *DbMgr) GetAnnouncedProducer(groupId string, pubkey string, prefix ...string) (*chestnutpb.AnnounceItem, error)
- func (dbMgr *DbMgr) GetAnnouncedUsersByGroup(groupId string, prefix ...string) ([]*chestnutpb.AnnounceItem, error)
- func (dbMgr *DbMgr) GetBlkedUsers(prefix ...string) ([]*chestnutpb.DenyUserItem, error)
- func (dbMgr *DbMgr) GetBlock(blockId string, cached bool, prefix ...string) (*chestnutpb.Block, error)
- func (dbMgr *DbMgr) GetBlockHeight(blockId string, prefix ...string) (int64, error)
- func (dbMgr *DbMgr) GetGroupsBytes() ([][]byte, error)
- func (dbMgr *DbMgr) GetGrpCtnt(groupId string, ctntype string, prefix ...string) ([]*chestnutpb.PostItem, error)
- func (dbMgr *DbMgr) GetParentBlock(blockId string, prefix ...string) (*chestnutpb.Block, error)
- func (dbMgr *DbMgr) GetProducers(groupId string, prefix ...string) ([]*chestnutpb.ProducerItem, error)
- func (dbMgr *DbMgr) GetSchemaByGroup(groupId, schemaType string, prefix ...string) (*chestnutpb.SchemaItem, error)
- func (dbMgr *DbMgr) GetSubBlock(blockId string, prefix ...string) ([]*chestnutpb.Block, error)
- func (dbMgr *DbMgr) GetTrx(trxId string, prefix ...string) (*chestnutpb.Trx, error)
- func (dbMgr *DbMgr) IsBlockExist(blockId string, cached bool, prefix ...string) (bool, error)
- func (dbMgr *DbMgr) IsParentExist(parentBlockId string, cached bool, prefix ...string) (bool, error)
- func (dbMgr *DbMgr) IsProducer(groupId, producerPubKey string, prefix ...string) (bool, error)
- func (dbMgr *DbMgr) IsProducerAnnounced(groupId, producerSignPubkey string, prefix ...string) (bool, error)
- func (dbMgr *DbMgr) IsTrxExist(trxId string, prefix ...string) (bool, error)
- func (dbMgr *DbMgr) IsUser(groupId, userPubKey string, prefix ...string) (bool, error)
- func (dbMgr *DbMgr) IsUserBlocked(groupId, userId string, prefix ...string) (bool, error)
- func (dbMgr *DbMgr) RemoveGroupData(item *chestnutpb.GroupItem, prefix ...string) error
- func (dbMgr *DbMgr) RmBlock(blockId string, cached bool, prefix ...string) error
- func (dbMgr *DbMgr) RmGroup(item *chestnutpb.GroupItem) error
- func (dbMgr *DbMgr) RmTrx(trxId string, prefix ...string) error
- func (dbMgr *DbMgr) TryMigration(nodeDataVer int)
- func (dbMgr *DbMgr) UpdGroup(groupItem *chestnutpb.GroupItem) error
- func (dbMgr *DbMgr) UpdTrx(trx *chestnutpb.Trx, prefix ...string) error
- func (dbMgr *DbMgr) UpdateAnnounce(trx *chestnutpb.Trx, prefix ...string) (err error)
- func (dbMgr *DbMgr) UpdateBlkListItem(trx *chestnutpb.Trx, prefix ...string) (err error)
- func (dbMgr *DbMgr) UpdateProducer(trx *chestnutpb.Trx, prefix ...string) error
- func (dbMgr *DbMgr) UpdateProducerAnnounceResult(groupId, producerSignPubkey string, result bool, prefix ...string) error
- func (dbMgr *DbMgr) UpdateSchema(trx *chestnutpb.Trx, prefix ...string) (err error)
- type Sequence
Constants ¶
View Source
const ANN_PREFIX = "ann" //announce
View Source
const ATH_PREFIX = "ath" //auth
View Source
const BLK_PREFIX = "blk" //block
View Source
const CHD_PREFIX = "chd" //cached
View Source
const CNT_PREFIX = "cnt" //content
View Source
const GRP_PREFIX = "grp" //group
View Source
const PRD_PREFIX = "prd" //producer
View Source
const SMA_PREFIX = "sma" //schema
View Source
const TRX_PREFIX = "trx" //trx
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CSBadger ¶
type CSBadger struct {
// contains filtered or unexported fields
}
func (*CSBadger) GetSequence ¶
func (*CSBadger) PrefixForeach ¶
func (*CSBadger) PrefixForeachKey ¶
type ChestnutStorage ¶
type ChestnutStorage interface { Init(path string) error Close() error Set(key []byte, val []byte) error Delete(key []byte) error Get(key []byte) ([]byte, error) PrefixForeach(prefix []byte, fn func([]byte, []byte, error) error) error PrefixForeachKey(prefix []byte, valid []byte, reverse bool, fn func([]byte, error) error) error Foreach(fn func([]byte, []byte, error) error) error IsExist([]byte) (bool, error) // For appdb, atomic batch write BatchWrite(keys [][]byte, values [][]byte) error GetSequence([]byte, uint64) (Sequence, error) }
type DbMgr ¶
type DbMgr struct { GroupInfoDb ChestnutStorage Db ChestnutStorage Auth ChestnutStorage DataPath string }
func (*DbMgr) AddGensisBlock ¶
func (dbMgr *DbMgr) AddGensisBlock(gensisBlock *chestnutpb.Block, prefix ...string) error
func (*DbMgr) AddGroup ¶
func (dbMgr *DbMgr) AddGroup(groupItem *chestnutpb.GroupItem) error
add group
func (*DbMgr) AddPost ¶
func (dbMgr *DbMgr) AddPost(trx *chestnutpb.Trx, prefix ...string) error
add post
func (*DbMgr) AddProducedBlockCount ¶
func (*DbMgr) AddProducer ¶
func (dbMgr *DbMgr) AddProducer(item *chestnutpb.ProducerItem, prefix ...string) error
func (*DbMgr) AddTrx ¶
func (dbMgr *DbMgr) AddTrx(trx *chestnutpb.Trx, prefix ...string) error
save trx
func (*DbMgr) GatherBlocksFromCache ¶
func (dbMgr *DbMgr) GatherBlocksFromCache(newBlock *chestnutpb.Block, cached bool, prefix ...string) ([]*chestnutpb.Block, error)
func (*DbMgr) GetAllSchemasByGroup ¶
func (dbMgr *DbMgr) GetAllSchemasByGroup(groupId string, prefix ...string) ([]*chestnutpb.SchemaItem, error)
func (*DbMgr) GetAnnounceProducersByGroup ¶
func (dbMgr *DbMgr) GetAnnounceProducersByGroup(groupId string, prefix ...string) ([]*chestnutpb.AnnounceItem, error)
func (*DbMgr) GetAnnouncedProducer ¶
func (dbMgr *DbMgr) GetAnnouncedProducer(groupId string, pubkey string, prefix ...string) (*chestnutpb.AnnounceItem, error)
func (*DbMgr) GetAnnouncedUsersByGroup ¶
func (dbMgr *DbMgr) GetAnnouncedUsersByGroup(groupId string, prefix ...string) ([]*chestnutpb.AnnounceItem, error)
func (*DbMgr) GetBlkedUsers ¶
func (dbMgr *DbMgr) GetBlkedUsers(prefix ...string) ([]*chestnutpb.DenyUserItem, error)
func (*DbMgr) GetBlock ¶
func (dbMgr *DbMgr) GetBlock(blockId string, cached bool, prefix ...string) (*chestnutpb.Block, error)
get block by block_id
func (*DbMgr) GetBlockHeight ¶
func (*DbMgr) GetGroupsBytes ¶
Get group list
func (*DbMgr) GetGrpCtnt ¶
func (*DbMgr) GetParentBlock ¶
func (*DbMgr) GetProducers ¶
func (dbMgr *DbMgr) GetProducers(groupId string, prefix ...string) ([]*chestnutpb.ProducerItem, error)
func (*DbMgr) GetSchemaByGroup ¶
func (dbMgr *DbMgr) GetSchemaByGroup(groupId, schemaType string, prefix ...string) (*chestnutpb.SchemaItem, error)
func (*DbMgr) GetSubBlock ¶
func (*DbMgr) IsBlockExist ¶
check if block existed
func (*DbMgr) IsParentExist ¶
func (dbMgr *DbMgr) IsParentExist(parentBlockId string, cached bool, prefix ...string) (bool, error)
check if parent block existed
func (*DbMgr) IsProducer ¶
func (*DbMgr) IsProducerAnnounced ¶
func (*DbMgr) IsTrxExist ¶
func (*DbMgr) IsUserBlocked ¶
func (*DbMgr) RemoveGroupData ¶
func (dbMgr *DbMgr) RemoveGroupData(item *chestnutpb.GroupItem, prefix ...string) error
func (*DbMgr) TryMigration ¶
func (*DbMgr) UpdateAnnounce ¶
func (dbMgr *DbMgr) UpdateAnnounce(trx *chestnutpb.Trx, prefix ...string) (err error)
func (*DbMgr) UpdateBlkListItem ¶
func (dbMgr *DbMgr) UpdateBlkListItem(trx *chestnutpb.Trx, prefix ...string) (err error)
func (*DbMgr) UpdateProducer ¶
func (dbMgr *DbMgr) UpdateProducer(trx *chestnutpb.Trx, prefix ...string) error
func (*DbMgr) UpdateProducerAnnounceResult ¶
func (*DbMgr) UpdateSchema ¶
func (dbMgr *DbMgr) UpdateSchema(trx *chestnutpb.Trx, prefix ...string) (err error)
Click to show internal directories.
Click to hide internal directories.