Documentation
¶
Index ¶
- Variables
- type Database
- type TState
- func (ts *TState) FetchAndSetScope(ctx context.Context, db Database, keys [][]byte) error
- func (ts *TState) GetValue(ctx context.Context, key []byte) ([]byte, error)
- func (ts *TState) Insert(ctx context.Context, key []byte, value []byte) error
- func (ts *TState) OpIndex() int
- func (ts *TState) Remove(ctx context.Context, key []byte) error
- func (ts *TState) Rollback(_ context.Context, restorePoint int)
- func (ts *TState) SetScope(_ context.Context, keys [][]byte)
- func (ts *TState) SetStorage(_ context.Context, key []byte, value []byte)
- func (ts *TState) WriteChanges(ctx context.Context, db Database, t trace.Tracer) error
Constants ¶
This section is empty.
Variables ¶
var ErrKeyNotSpecified = errors.New("key not specified")
Functions ¶
This section is empty.
Types ¶
type TState ¶
type TState struct {
// contains filtered or unexported fields
}
TState defines a struct for storing temporary state.
func New ¶
New returns a new instance of TState. Initializes the storage and changedKeys maps to have an initial size of [storageSize] and [changedSize] respectively.
func (*TState) FetchAndSetScope ¶
FetchAndSetScope updates ts to include the [db] values associated with [keys]. FetchAndSetScope then sets the scope of ts to [keys]. If a key exists in ts.fetchCache set the key's value to the value from cache.
func (*TState) GetValue ¶
GetValue returns the value associated from tempStorage with the associated [key]. If [key] does not exist in readScope or if it is not found in storage an error is returned.
func (*TState) SetStorage ¶
SetStorage sets ts.storage[key] = {value, true}. Does not add to storage if ts already stores a mapping with key, or that key was previously modified.