Versions in this module Expand all Collapse all v0 v0.0.5 Oct 28, 2022 Changes in this version type Context + func NewContext(name string, driver Driver, reload bool, routineSize int, ...) (*Context, error) + func (ctx *Context) Hasher() *bsmt.Hasher + func (ctx *Context) RoutinePool() *ants.Pool v0.0.4 Oct 13, 2022 Changes in this version + type AssetTreeCache struct + func NewLazyTreeCache(maxSize int, accountNumber int64, blockNumber int64, ...) *AssetTreeCache + func (c *AssetTreeCache) CleanChanges() + func (c *AssetTreeCache) Get(i int64) (tree bsmt.SparseMerkleTree) + func (c *AssetTreeCache) GetChanges() []int64 + func (c *AssetTreeCache) GetNextAccountIndex() int64 + func (c *AssetTreeCache) UpdateCache(accountNumber, latestBlock int64) v0.0.3 Sep 22, 2022 Changes in this version + const AccountAssetPrefix + const AccountPrefix + const AccountTreeHeight + const AssetTreeHeight + const LiquidityPrefix + const LiquidityTreeHeight + const NFTPrefix + const NftTreeHeight + var ErrUnsupportedDriver = errors.New("unsupported db driver") + var NilAccountAssetNodeHash []byte + var NilAccountAssetRoot []byte + var NilAccountNodeHash []byte + var NilAccountRoot []byte + var NilHash = merkleTree.NilHash + var NilLiquidityNodeHash []byte + var NilLiquidityRoot []byte + var NilNftNodeHash []byte + var NilNftRoot []byte + var NilStateRoot []byte + func AccountToNode(accountNameHash string, publicKey string, nonce int64, collectionNonce int64, ...) (hashVal []byte, err error) + func AssetToNode(balance string, lpAmount string, offerCanceledOrFinalized string) (hashVal []byte, err error) + func CommitTrees(pool *ants.Pool, version uint64, accountTree bsmt.SparseMerkleTree, ...) error + func ComputeAccountAssetLeafHash(balance string, lpAmount string, offerCanceledOrFinalized string) (hashVal []byte, err error) + func ComputeAccountLeafHash(accountNameHash string, pk string, nonce int64, collectionNonce int64, ...) (hashVal []byte, err error) + func ComputeLiquidityAssetLeafHash(assetAId int64, assetA string, assetBId int64, assetB string, lpAmount string, ...) (hashVal []byte, err error) + func ComputeNftAssetLeafHash(creatorAccountIndex int64, ownerAccountIndex int64, nftContentHash string, ...) (hashVal []byte, err error) + func ComputeStateRootHash(accountRoot []byte, liquidityRoot []byte, nftRoot []byte) []byte + func EmptyAccountAssetNodeHash() []byte + func EmptyAccountNodeHash() []byte + func EmptyLiquidityNodeHash() []byte + func EmptyNftNodeHash() []byte + func InitAccountTree(accountModel account.AccountModel, ...) (accountTree bsmt.SparseMerkleTree, accountAssetTrees []bsmt.SparseMerkleTree, ...) + func InitLiquidityTree(liquidityHistoryModel liquidity.LiquidityHistoryModel, blockHeight int64, ...) (liquidityTree bsmt.SparseMerkleTree, err error) + func InitNftTree(nftHistoryModel nft.L2NftHistoryModel, blockHeight int64, ctx *Context) (nftTree bsmt.SparseMerkleTree, err error) + func LiquidityAssetToNode(assetAId int64, assetA string, assetBId int64, assetB string, lpAmount string, ...) (hashVal []byte, err error) + func NewEmptyAccountAssetTree(ctx *Context, index int64, blockHeight uint64) (tree bsmt.SparseMerkleTree, err error) + func NewMemAccountAssetTree() (tree bsmt.SparseMerkleTree, err error) + func NftAssetToNode(nftAsset *nft.L2NftHistory) (hashVal []byte, err error) + func RollBackTrees(pool *ants.Pool, version uint64, accountTree bsmt.SparseMerkleTree, ...) error + func SetNamespace(context *Context, namespace string) database.TreeDB + func SetupTreeDB(context *Context) error + type Context struct + Driver Driver + LevelDBOption *LevelDBOption + Name string + RedisDBOption *RedisDBOption + Reload bool + TreeDB database.TreeDB + func (ctx *Context) BatchReloadSize() int + func (ctx *Context) IsLoad() bool + func (ctx *Context) Options(blockHeight int64) []bsmt.Option + func (ctx *Context) SetBatchReloadSize(size int) + func (ctx *Context) SetOptions(opts ...bsmt.Option) + type Driver string + const LevelDB + const MemoryDB + const RedisDB + type LevelDBOption struct + Cache int + File string + Handles int + type RedisDBOption struct + Addr string + ClusterAddr []string + DialTimeout time.Duration + IdleCheckFrequency time.Duration + IdleTimeout time.Duration + MaxConnAge time.Duration + MaxRedirects int + MaxRetries int + MaxRetryBackoff time.Duration + MinIdleConns int + MinRetryBackoff time.Duration + Password string + PoolFIFO bool + PoolSize int + PoolTimeout time.Duration + ReadOnly bool + ReadTimeout time.Duration + RouteByLatency bool + RouteRandomly bool + Username string + WriteTimeout time.Duration