state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package state is the --state-dir SQLite store behind the proxy's in-memory indexes: job records, Idempotency-Key claims, the asset index, and the output-id signing secret. One store belongs to one proxy and one ComfyUI.

The schema matches the reference, so a state directory written by the Python proxy opens here, plus a nullable assets.expires_at column that the reference never persisted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {

	// Warnings lists permission changes that could not be made. They are not
	// fatal, as in the reference: a filesystem without POSIX modes (FAT, some
	// network mounts) still works, it just cannot be locked down.
	Warnings []string
	// contains filtered or unexported fields
}

Store implements proxy.Persist.

func Open

func Open(dir string) (*Store, error)

Open creates or opens dir/state.sqlite3. The directory is 0700 and the database 0600: it holds the HMAC secret that signs output asset ids, and any local user who could read it could mint valid ids. The directory mode also covers the WAL and SHM files SQLite creates beside it.

func (*Store) ClaimIdempotency

func (s *Store) ClaimIdempotency(key string, claimedAt time.Time) (bool, error)

func (*Store) Close

func (s *Store) Close() error

Close closes the database.

func (*Store) DeleteAsset

func (s *Store) DeleteAsset(id string) error

func (*Store) GetJob

func (s *Store) GetJob(id string) (*proxy.JobRecord, error)

func (*Store) GetJobWorkflow

func (s *Store) GetJobWorkflow(id string) (json.RawMessage, error)

func (*Store) GetMeta

func (s *Store) GetMeta(key string) (string, bool, error)

func (*Store) LoadAssets

func (s *Store) LoadAssets() ([]proxy.AssetRecord, map[string]string, error)

func (*Store) LoadIdempotencyKeys

func (s *Store) LoadIdempotencyKeys() ([]string, error)

func (*Store) LoadJobs

func (s *Store) LoadJobs(limit int) ([]proxy.JobRecord, error)

func (*Store) ReleaseIdempotency

func (s *Store) ReleaseIdempotency(key string) error

func (*Store) SetMeta

func (s *Store) SetMeta(key, value string) error

func (*Store) TrimIdempotency

func (s *Store) TrimIdempotency(max int) error

func (*Store) UpsertAsset

func (s *Store) UpsertAsset(rec proxy.AssetRecord) error

func (*Store) UpsertJob

func (s *Store) UpsertJob(rec proxy.JobRecord) error

Jump to

Keyboard shortcuts

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