storage

package
v0.0.0-...-ce6788a Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BboltStore

type BboltStore struct {
	DB      *bolt.DB
	DBPath  string
	Writing int
	//Writer  string
	Closing bool
	Buckets []string
}

func NewBBoltDB

func NewBBoltDB(dbPath, dbName string) (*BboltStore, error)

func (*BboltStore) GetAllMiniblockDetails

func (bbs *BboltStore) GetAllMiniblockDetails() map[string][]*structures.MBLInfo

Returns all miniblock details for synced chain

func (*BboltStore) GetAllNormalTxWithSCIDByAddr

func (bbs *BboltStore) GetAllNormalTxWithSCIDByAddr(addr string) (normTxsWithSCID []*structures.NormalTXWithSCIDParse)

Returns all normal txs with SCIDs based on a given address

func (*BboltStore) GetAllNormalTxWithSCIDBySCID

func (bbs *BboltStore) GetAllNormalTxWithSCIDBySCID(scid string) (normTxsWithSCID []*structures.NormalTXWithSCIDParse)

Returns all normal txs with SCIDs based on a given SCID

func (*BboltStore) GetAllOwnersAndSCIDs

func (bbs *BboltStore) GetAllOwnersAndSCIDs() map[string]string

Returns all of the deployed SCIDs with their corresponding owners (who deployed it)

func (*BboltStore) GetAllSCIDInvokeDetails

func (bbs *BboltStore) GetAllSCIDInvokeDetails(scid string) (invokedetails []*structures.SCTXParse)

Returns all scinvoke calls from a given scid

func (*BboltStore) GetAllSCIDInvokeDetailsByEntrypoint

func (bbs *BboltStore) GetAllSCIDInvokeDetailsByEntrypoint(scid string, entrypoint string) (invokedetails []*structures.SCTXParse)

Retruns all scinvoke calls from a given scid that match a given entrypoint

func (*BboltStore) GetAllSCIDInvokeDetailsBySigner

func (bbs *BboltStore) GetAllSCIDInvokeDetailsBySigner(scid string, signerPart string) (invokedetails []*structures.SCTXParse)

Returns all scinvoke calls from a given scid that match a given signer

func (*BboltStore) GetAllSCIDVariableDetails

func (bbs *BboltStore) GetAllSCIDVariableDetails(scid string) (hVars []*structures.SCIDVariable)

Gets SC variables at all topoheights

func (*BboltStore) GetGetInfoDetails

func (bbs *BboltStore) GetGetInfoDetails() (getinfo *structures.GetInfo)

Returns simple getinfo polling from the daemon

func (*BboltStore) GetInteractionIndex

func (bbs *BboltStore) GetInteractionIndex(topoheight int64, heights []int64, rmax bool) (height int64)

func (*BboltStore) GetInvalidSCIDDeploys

func (bbs *BboltStore) GetInvalidSCIDDeploys() map[string]uint64

Gets any SCIDs that were attempted to be deployed but not correct and their fees

func (*BboltStore) GetLastIndexHeight

func (bbs *BboltStore) GetLastIndexHeight() (topoheight int64, err error)

Gets bbolt's last indexed height - this is for stateful stores on close and reference on open

func (*BboltStore) GetMiniblockCountByAddress

func (bbs *BboltStore) GetMiniblockCountByAddress(addr string) (miniblocks int64)

Gets counts of miniblock finders by address

func (*BboltStore) GetMiniblockDetailsByHash

func (bbs *BboltStore) GetMiniblockDetailsByHash(blid string) (miniblocks []*structures.MBLInfo)

Returns the miniblocks within a given blid if previously stored

func (*BboltStore) GetOwner

func (bbs *BboltStore) GetOwner(scid string) string

Returns the owner (who deployed it) of a given scid

func (*BboltStore) GetSCIDInteractionByAddr

func (bbs *BboltStore) GetSCIDInteractionByAddr(addr string) (scids []string)

Gets all SCID interacts from a given address - non-builtin/name scids.

func (*BboltStore) GetSCIDInteractionHeight

func (bbs *BboltStore) GetSCIDInteractionHeight(scid string) (scidinteractions []int64)

Gets SC interaction height and detail by a given SCID

func (*BboltStore) GetSCIDKeysByValue

func (bbs *BboltStore) GetSCIDKeysByValue(scid string, val interface{}, height int64, rmax bool) (keysstring []string, keysuint64 []uint64)

Gets SC variable keys at given topoheight who's value equates to a given interface{} (string/uint64)

func (*BboltStore) GetSCIDValuesByKey

func (bbs *BboltStore) GetSCIDValuesByKey(scid string, key interface{}, height int64, rmax bool) (valuesstring []string, valuesuint64 []uint64)

Gets SC values by key at given topoheight who's key equates to a given interface{} (string/uint64)

func (*BboltStore) GetSCIDVariableDetailsAtTopoheight

func (bbs *BboltStore) GetSCIDVariableDetailsAtTopoheight(scid string, topoheight int64) (hVars []*structures.SCIDVariable)

Gets SC variables at a given topoheight

func (*BboltStore) GetTxCount

func (bbs *BboltStore) GetTxCount(txType string) (txCount int64)

Gets bbolt's txcount by a given txType - this is for stateful stores on close and reference on open

func (*BboltStore) StoreAltDBInput

func (bbs *BboltStore) StoreAltDBInput(treenames []string, altdb *GravitonStore) (err error)

Writes to disk RAM-stored data

func (*BboltStore) StoreGetInfoDetails

func (bbs *BboltStore) StoreGetInfoDetails(getinfo *structures.GetInfo) (changes bool, err error)

Stores simple getinfo polling from the daemon

func (*BboltStore) StoreInvalidSCIDDeploys

func (bbs *BboltStore) StoreInvalidSCIDDeploys(scid string, fee uint64) (changes bool, err error)

Stores any SCIDs that were attempted to be deployed but not correct - log scid/fees burnt attempting it.

func (*BboltStore) StoreInvokeDetails

func (bbs *BboltStore) StoreInvokeDetails(scid string, signer string, entrypoint string, topoheight int64, invokedetails *structures.SCTXParse) (changes bool, err error)

Stores all scinvoke details of a given scid

func (*BboltStore) StoreLastIndexHeight

func (bbs *BboltStore) StoreLastIndexHeight(last_indexedheight int64) (changes bool, err error)

Stores bbolt's last indexed height - this is for stateful stores on close and reference on open

func (*BboltStore) StoreMiniblockCountByAddress

func (bbs *BboltStore) StoreMiniblockCountByAddress(addr string) (changes bool, err error)

Stores counts of miniblock finders by address

func (*BboltStore) StoreMiniblockDetailsByHash

func (bbs *BboltStore) StoreMiniblockDetailsByHash(blid string, mbldetails []*structures.MBLInfo) (changes bool, err error)

Stores the miniblocks within a given blid

func (*BboltStore) StoreNormalTxWithSCIDByAddr

func (bbs *BboltStore) StoreNormalTxWithSCIDByAddr(addr string, normTxWithSCID *structures.NormalTXWithSCIDParse) (changes bool, err error)

Stores all normal txs with SCIDs and their respective ring members for future balance/interaction reference

func (*BboltStore) StoreOwner

func (bbs *BboltStore) StoreOwner(scid string, owner string) (changes bool, err error)

Stores the owner (who deployed it) of a given scid

func (*BboltStore) StoreSCIDInteractionHeight

func (bbs *BboltStore) StoreSCIDInteractionHeight(scid string, height int64) (changes bool, err error)

Stores SC interaction height and detail - height invoked upon and type (scinstall/scinvoke). This is separate tree & k/v since we can query it for other things at less data retrieval

func (*BboltStore) StoreSCIDVariableDetails

func (bbs *BboltStore) StoreSCIDVariableDetails(scid string, variables []*structures.SCIDVariable, topoheight int64) (changes bool, err error)

Stores SC variables at a given topoheight (called on any new scdeploy or scinvoke actions)

func (*BboltStore) StoreTxCount

func (bbs *BboltStore) StoreTxCount(count int64, txType string) (changes bool, err error)

Stores bbolt's txcount by a given txType - this is for stateful stores on close and reference on open

type GravitonStore

type GravitonStore struct {
	DB      *graviton.Store
	DBPath  string
	DBTrees []string

	DBMaxSnapshot uint64
	DBMigrateWait time.Duration
	Writing       int
	Closing       bool
	// contains filtered or unexported fields
}

func NewGravDB

func NewGravDB(dbPath, dbmigratewait string) (*GravitonStore, error)

---- Application Graviton/Backend functions ---- // Builds new Graviton DB based on input from main()

func NewGravDBRAM

func NewGravDBRAM(dbmigratewait string) (*GravitonStore, error)

Builds new Graviton DB based on input from main() RAM store

func (*GravitonStore) CommitTrees

func (g *GravitonStore) CommitTrees(trees []*graviton.Tree) (cv uint64, err error)

Commits multiple trees and returns the commit version and errs

func (*GravitonStore) GetAllMiniblockDetails

func (g *GravitonStore) GetAllMiniblockDetails() (mbldetails map[string][]*structures.MBLInfo)

Returns all miniblock details for synced chain

func (*GravitonStore) GetAllNormalTxWithSCIDByAddr

func (g *GravitonStore) GetAllNormalTxWithSCIDByAddr(addr string) (normTxsWithSCID []*structures.NormalTXWithSCIDParse)

Returns all normal txs with SCIDs based on a given address

func (*GravitonStore) GetAllNormalTxWithSCIDBySCID

func (g *GravitonStore) GetAllNormalTxWithSCIDBySCID(scid string) (normTxsWithSCID []*structures.NormalTXWithSCIDParse)

Returns all normal txs with SCIDs based on a given SCID

func (*GravitonStore) GetAllOwnersAndSCIDs

func (g *GravitonStore) GetAllOwnersAndSCIDs() (results map[string]string)

Returns all of the deployed SCIDs with their corresponding owners (who deployed it)

func (*GravitonStore) GetAllSCIDInvokeDetails

func (g *GravitonStore) GetAllSCIDInvokeDetails(scid string) (invokedetails []*structures.SCTXParse)

Returns all scinvoke calls from a given scid

func (*GravitonStore) GetAllSCIDInvokeDetailsByEntrypoint

func (g *GravitonStore) GetAllSCIDInvokeDetailsByEntrypoint(scid string, entrypoint string) (invokedetails []*structures.SCTXParse)

Retruns all scinvoke calls from a given scid that match a given entrypoint

func (*GravitonStore) GetAllSCIDInvokeDetailsBySigner

func (g *GravitonStore) GetAllSCIDInvokeDetailsBySigner(scid string, signerPart string) (invokedetails []*structures.SCTXParse)

Returns all scinvoke calls from a given scid that match a given signer

func (*GravitonStore) GetAllSCIDVariableDetails

func (g *GravitonStore) GetAllSCIDVariableDetails(scid string) (hVars []*structures.SCIDVariable)

Gets SC variables at all topoheights

func (*GravitonStore) GetGetInfoDetails

func (g *GravitonStore) GetGetInfoDetails() (getinfo *structures.GetInfo)

Returns simple getinfo polling from the daemon

func (*GravitonStore) GetInteractionIndex

func (g *GravitonStore) GetInteractionIndex(topoheight int64, heights []int64, rmax bool) (height int64)

func (*GravitonStore) GetInvalidSCIDDeploys

func (g *GravitonStore) GetInvalidSCIDDeploys() (invalidSCIDs map[string]uint64)

Gets any SCIDs that were attempted to be deployed but not correct and their fees

func (*GravitonStore) GetLastIndexHeight

func (g *GravitonStore) GetLastIndexHeight() (topoheight int64, err error)

Gets gnomon's last indexed height - this is for stateful stores on close and reference on open

func (*GravitonStore) GetMiniblockCountByAddress

func (g *GravitonStore) GetMiniblockCountByAddress(addr string) (miniblocks int64)

Gets counts of miniblock finders by address

func (*GravitonStore) GetMiniblockDetailsByHash

func (g *GravitonStore) GetMiniblockDetailsByHash(blid string) (miniblocks []*structures.MBLInfo)

Returns the miniblocks within a given blid if previously stored

func (*GravitonStore) GetOwner

func (g *GravitonStore) GetOwner(scid string) string

Returns the owner (who deployed it) of a given scid

func (*GravitonStore) GetSCIDInteractionByAddr

func (g *GravitonStore) GetSCIDInteractionByAddr(addr string) (scids []string)

Gets all SCID interacts from a given address - non-builtin/name scids.

func (*GravitonStore) GetSCIDInteractionHeight

func (g *GravitonStore) GetSCIDInteractionHeight(scid string) (scidinteractions []int64)

Gets SC interaction height and detail by a given SCID

func (*GravitonStore) GetSCIDKeysByValue

func (g *GravitonStore) GetSCIDKeysByValue(scid string, val interface{}, height int64, rmax bool) (keysstring []string, keysuint64 []uint64)

Gets SC variable keys at given topoheight who's value equates to a given interface{} (string/uint64)

func (*GravitonStore) GetSCIDValuesByKey

func (g *GravitonStore) GetSCIDValuesByKey(scid string, key interface{}, height int64, rmax bool) (valuesstring []string, valuesuint64 []uint64)

Gets SC values by key at given topoheight who's key equates to a given interface{} (string/uint64)

func (*GravitonStore) GetSCIDVariableDetailsAtTopoheight

func (g *GravitonStore) GetSCIDVariableDetailsAtTopoheight(scid string, topoheight int64) (hVars []*structures.SCIDVariable)

Gets SC variables at a given topoheight

func (*GravitonStore) GetTxCount

func (g *GravitonStore) GetTxCount(txType string) int64

Gets gnomon's txcount by a given txType - this is for stateful stores on close and reference on open

func (*GravitonStore) StoreAltDBInput

func (g *GravitonStore) StoreAltDBInput(treenames []string, altdb *GravitonStore) (err error)

Writes to disk RAM-stored data

func (*GravitonStore) StoreGetInfoDetails

func (g *GravitonStore) StoreGetInfoDetails(getinfo *structures.GetInfo, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores simple getinfo polling from the daemon

func (*GravitonStore) StoreInvalidSCIDDeploys

func (g *GravitonStore) StoreInvalidSCIDDeploys(scid string, fee uint64, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores any SCIDs that were attempted to be deployed but not correct - log scid/fees burnt attempting it.

func (*GravitonStore) StoreInvokeDetails

func (g *GravitonStore) StoreInvokeDetails(scid string, signer string, entrypoint string, topoheight int64, invokedetails *structures.SCTXParse, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores all scinvoke details of a given scid

func (*GravitonStore) StoreLastIndexHeight

func (g *GravitonStore) StoreLastIndexHeight(last_indexedheight int64, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores gnomon's last indexed height - this is for stateful stores on close and reference on open

func (*GravitonStore) StoreMiniblockCountByAddress

func (g *GravitonStore) StoreMiniblockCountByAddress(addr string, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores counts of miniblock finders by address

func (*GravitonStore) StoreMiniblockDetailsByHash

func (g *GravitonStore) StoreMiniblockDetailsByHash(blid string, mbldetails []*structures.MBLInfo, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores the miniblocks within a given blid

func (*GravitonStore) StoreNormalTxWithSCIDByAddr

func (g *GravitonStore) StoreNormalTxWithSCIDByAddr(addr string, normTxWithSCID *structures.NormalTXWithSCIDParse, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores all normal txs with SCIDs and their respective ring members for future balance/interaction reference

func (*GravitonStore) StoreOwner

func (g *GravitonStore) StoreOwner(scid string, owner string, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores the owner (who deployed it) of a given scid

func (*GravitonStore) StoreSCIDInteractionHeight

func (g *GravitonStore) StoreSCIDInteractionHeight(scid string, height int64, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores SC interaction height and detail - height invoked upon and type (scinstall/scinvoke). This is separate tree & k/v since we can query it for other things at less data retrieval

func (*GravitonStore) StoreSCIDVariableDetails

func (g *GravitonStore) StoreSCIDVariableDetails(scid string, variables []*structures.SCIDVariable, topoheight int64, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores SC variables at a given topoheight (called on any new scdeploy or scinvoke actions)

func (*GravitonStore) StoreTxCount

func (g *GravitonStore) StoreTxCount(count int64, txType string, nocommit bool) (tree *graviton.Tree, changes bool, err error)

Stores gnomon's txcount by a given txType - this is for stateful stores on close and reference on open

type TreeKV

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

Jump to

Keyboard shortcuts

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