util

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package util provides common utilities for checkpoint store implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCheckpointNotFound

func ErrCheckpointNotFound(checkpointID string) error

ErrCheckpointNotFound creates a "checkpoint not found" error.

func ErrNoThreadCheckpoints

func ErrNoThreadCheckpoints(threadID string) error

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.

Jump to

Keyboard shortcuts

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