state

package
v0.0.0-...-6248505 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State struct {
	*domain.StateBase
}

State represents database interactions dealing with command block.

func NewState

func NewState(factory coredatabase.TxnRunnerFactory) *State

NewState returns a new block device state based on the input database factory method.

func (*State) GetBlockMessage

func (s *State) GetBlockMessage(ctx context.Context, t blockcommand.BlockType) (string, error)

func (*State) GetBlocks

func (s *State) GetBlocks(ctx context.Context) ([]blockcommand.Block, error)

GetBlocks returns all the blocks for the current model.

func (*State) RemoveAllBlocks

func (s *State) RemoveAllBlocks(ctx context.Context) error

RemoveAllBlocks removes all blocks for the current model. If no blocks are found, returns nil.

func (*State) RemoveBlock

func (s *State) RemoveBlock(ctx context.Context, t blockcommand.BlockType) error

RemoveBlock disables block of specified type for the current model. Returns an error errors.BlockNotFound.

func (*State) SetBlock

func (s *State) SetBlock(ctx context.Context, t blockcommand.BlockType, message string) error

SetBlock switches on a command block for a given type with an optional message. Returns an error errors.BlockAlreadyExists.

Jump to

Keyboard shortcuts

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