Documentation
¶
Overview ¶
Package util provides common utilities for checkpoint store implementations.
Index ¶
- func ErrCheckpointNotFound(checkpointID string) error
- func ErrNoThreadCheckpoints(threadID string) error
- func ExtractMetadataIDs(checkpoint *Checkpoint) (executionID, threadID string)
- func MarshalCheckpointData(checkpoint *Checkpoint) (stateJSON, metadataJSON []byte, err error)
- func SortCheckpointsByVersion(checkpoints []*Checkpoint)
- func UnmarshalCheckpointData(stateJSON, metadataJSON []byte, cp *Checkpoint) error
- type Checkpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrCheckpointNotFound ¶
ErrCheckpointNotFound creates a "checkpoint not found" error.
func ErrNoThreadCheckpoints ¶
ErrNoThreadCheckpoints creates a "no checkpoints found for thread" error.
func ExtractMetadataIDs ¶
func ExtractMetadataIDs(checkpoint *Checkpoint) (executionID, threadID string)
ExtractMetadataIDs extracts execution_id and thread_id from checkpoint metadata. Returns empty strings if the keys are not present or have wrong types.
func MarshalCheckpointData ¶
func MarshalCheckpointData(checkpoint *Checkpoint) (stateJSON, metadataJSON []byte, err error)
MarshalCheckpointData marshals checkpoint state and metadata to JSON. Returns the JSON bytes and any error that occurred during marshaling.
func SortCheckpointsByVersion ¶
func SortCheckpointsByVersion(checkpoints []*Checkpoint)
SortCheckpointsByVersion sorts a slice of checkpoints by version in ascending order. Modifies the slice in place.
func UnmarshalCheckpointData ¶
func UnmarshalCheckpointData(stateJSON, metadataJSON []byte, cp *Checkpoint) error
UnmarshalCheckpointData unmarshals state and metadata from JSON into a checkpoint. Returns any error that occurred during unmarshaling.
Types ¶
type Checkpoint ¶
type Checkpoint = graph.Checkpoint
Checkpoint wraps graph.Checkpoint for store implementations.
func GetLastFromSorted ¶
func GetLastFromSorted(checkpoints []*Checkpoint) (*Checkpoint, error)
GetLastFromSorted returns the last checkpoint from a sorted slice. Returns an error if the slice is empty.