internal

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

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

func (c *Cell) HasValue() bool

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

func (c *Cell) Read(p []byte) (n int, err error)

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

func (*Cell) Write

func (c *Cell) Write(p []byte) (n int, err error)

Write writes the given slice into the cell.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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