Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateFolderCountKey(folder string) string
- func GenerateFolderExistKey(folder string) string
- func GenerateObjectExistKey(object string) string
- type Module
- func (m *Module) AutoMigrate() error
- func (m *Module) ClearCtx()
- func (m *Module) ExtractEventStatements(ctx context.Context, block *tmctypes.ResultBlock, txHash common.Hash, ...) (map[string][]interface{}, error)
- func (m *Module) GetCtx(key string) interface{}
- func (m *Module) HandleEvent(ctx context.Context, block *tmctypes.ResultBlock, txHash common.Hash, ...) error
- func (m *Module) Name() string
- func (m *Module) PrepareTables() error
- func (m *Module) SetCtx(key string, val interface{})
Constants ¶
const (
ModuleName = "prefix_tree"
)
Variables ¶
var ( EventCreateObject = proto.MessageName(&storagetypes.EventCreateObject{}) EventDeleteObject = proto.MessageName(&storagetypes.EventDeleteObject{}) EventCancelCreateObject = proto.MessageName(&storagetypes.EventCancelCreateObject{}) EventRejectSealObject = proto.MessageName(&storagetypes.EventRejectSealObject{}) )
var BuildPrefixTreeEvents = map[string]bool{ EventCreateObject: true, EventDeleteObject: true, EventCancelCreateObject: true, EventRejectSealObject: true, }
BuildPrefixTreeEvents maps event types that trigger the creation or deletion of prefix tree nodes. If an event type is present and set to true in this map, it means that event will result in changes to the prefix tree structure.
Functions ¶
func GenerateFolderCountKey ¶ added in v1.2.0
func GenerateFolderExistKey ¶ added in v1.2.0
func GenerateObjectExistKey ¶ added in v1.2.0
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents the object module
func (*Module) AutoMigrate ¶
func (*Module) ClearCtx ¶ added in v1.2.0
func (m *Module) ClearCtx()
ClearCtx resets the module's context to a new, empty context. This effectively removes all key-value pairs previously stored in the context. This can be used for cleanup or reinitialization purposes.
func (*Module) ExtractEventStatements ¶ added in v0.2.3
func (*Module) GetCtx ¶ added in v1.2.0
GetCtx retrieves the value associated with a given key from the module's context. If the key exists in the context, it returns the value; otherwise, it returns nil. This is commonly used to access data that was previously stored with Set.
func (*Module) HandleEvent ¶
func (m *Module) HandleEvent(ctx context.Context, block *tmctypes.ResultBlock, txHash common.Hash, event sdk.Event) error
HandleEvent handles the events relevant to the building of the PrefixTree. It checks the type of the event and calls the appropriate handler for it.