Documentation ¶
Index ¶
- type Cell
- func (c *Cell) Delete()
- func (c *Cell) GetStateMutation(name string) *protocol.FromFunction_PersistedValueMutation
- func (c *Cell) HasValue() bool
- func (c *Cell) Read(p []byte) (n int, err error)
- func (c *Cell) Reset()
- func (c *Cell) SeekToBeginning()
- func (c *Cell) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct {
// contains filtered or unexported fields
}
Cell is a mutable, persisted value. This struct is not thread safe.
func NewCell ¶
func NewCell(state *protocol.ToFunction_PersistedValue, typeTypeName string) *Cell
NewCell creates and initializes a new Cell using state's value as its initial contents. The new Cell takes ownership of state, and the caller should not use state after this call.
func (*Cell) Delete ¶
func (c *Cell) Delete()
Delete marks the value to be deleted and resets the cell to be empty,
func (*Cell) GetStateMutation ¶
func (c *Cell) GetStateMutation(name string) *protocol.FromFunction_PersistedValueMutation
GetStateMutation turns the final Cell into a FromFunction_PersistedValueMutation. The new FromFunction_PersistedValueMutation takes ownership of the underlying buffer and the cell should not be used after this function returns.
func (*Cell) HasValue ¶
HasValue returns true if the cell contains a valid value, if the value is false, calls to Read will consume 0 bytes
func (*Cell) Read ¶
Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Read is resumable and returns EOF when there are no more bytes to read. This behavior is required for Cell to interoperate with the go standard library. Users of Cell are required to call SeekToBeginning, before the first read to ensure reads always begin at the start of the buffer.
func (*Cell) Reset ¶
func (c *Cell) Reset()
Reset resets the cell to be empty. This method must be called when setting a new value in storage to ensure the new value overrides the previous.
func (*Cell) SeekToBeginning ¶
func (c *Cell) SeekToBeginning()
SeekToBeginning resets the cell so the next read starts from the beginning of the underlying buffer, regardless of where the last read left off