Documentation ¶
Index ¶
- func Append(key []byte, value []byte)
- func ChangesRoot(parent_hash int64) int64
- func Clear(key []byte)
- func ClearPrefix(key []byte, limit []byte)
- func CommitTransaction()
- func Exists(key []byte) int32
- func Get(key []byte) sc.Option[sc.Sequence[sc.U8]]
- func GetDecode[T sc.Encodable](key []byte, decodeFunc func(buffer *bytes.Buffer) T) T
- func GetDecodeOnEmpty[T sc.Encodable](key []byte, decodeFunc func(buffer *bytes.Buffer) T, onEmpty T) T
- func NextKey(key int64) int64
- func Read(key []byte, valueOut []byte, offset int32) sc.Option[sc.U32]
- func RollbackTransaction()
- func Root(version int32) []byte
- func Set(key []byte, value []byte)
- func StartTransaction()
- func TakeBytes(key []byte) []byte
- func TakeDecode[T sc.Encodable](key []byte, decodeFunc func(buffer *bytes.Buffer) T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangesRoot ¶
func ClearPrefix ¶
func CommitTransaction ¶
func CommitTransaction()
CommitTransaction Commit the last transaction started by `start_transaction`.
Any changes made during that transaction are committed.
Panics ¶
Will panic if there is no open transaction.
func GetDecode ¶
GetDecode gets the storage value and returns it decoded. The result from Get is Option<sc.Sequence[sc.U8]>. If the option is empty, it returns the default value T. If the option is not empty, it decodes it using decodeFunc and returns it.
func GetDecodeOnEmpty ¶
func RollbackTransaction ¶
func RollbackTransaction()
RollbackTransaction Rollback the last transaction started by `start_transaction`.
Any changes made during that transaction are discarded.
Panics ¶
Will panic if there is no open transaction.
func StartTransaction ¶
func StartTransaction()
StartTransaction Start a new nested transaction.
This allows to either commit or roll back all changes that are made after this call. For every transaction there must be a matching call to either `rollback_transaction` or `commit_transaction`. This is also effective for all values manipulated using the `DefaultChildStorage` API.
Warning ¶
This is a low level API that is potentially dangerous as it can easily result in unbalanced transactions. For example, FRAME users should use high level storage abstractions.
func TakeBytes ¶
TakeBytes gets the storage value. The result from Get is Option<sc.Sequence[sc.U8]>. If the option is empty, it returns nil. If the option is not empty, it clears it and returns the sequence as bytes.
func TakeDecode ¶
TakeDecode gets the storage value and returns it decoded. The result from Get is Option<sc.Sequence[sc.U8]>. If the option is empty, it returns default value T. If the option is not empty, it clears it and returns decodeFunc(value).
Types ¶
This section is empty.