retaineddata

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("retained data record not found")
	ErrInvalidRecord = errors.New("retained data record is invalid")
)

Functions

func NewRetainedID

func NewRetainedID() (string, error)

Types

type BindRequest

type BindRequest struct {
	RetainedID            string    `json:"retained_id"`
	BoundPluginInstanceID string    `json:"bound_plugin_instance_id"`
	Now                   time.Time `json:"now,omitempty"`
}

type DeleteFailedRequest

type DeleteFailedRequest struct {
	RetainedID  string    `json:"retained_id"`
	DeleteError string    `json:"delete_error,omitempty"`
	Now         time.Time `json:"now,omitempty"`
}

type DeleteRequest

type DeleteRequest struct {
	RetainedID string    `json:"retained_id"`
	Now        time.Time `json:"now,omitempty"`
}

type ListRequest

type ListRequest struct {
	PublisherID            string `json:"publisher_id,omitempty"`
	PluginID               string `json:"plugin_id,omitempty"`
	SourcePluginInstanceID string `json:"source_plugin_instance_id,omitempty"`
	State                  State  `json:"state,omitempty"`
}

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(_ context.Context, retainedID string) error

func (*MemoryStore) ExpireBefore

func (s *MemoryStore) ExpireBefore(_ context.Context, now time.Time) ([]Record, error)

func (*MemoryStore) Get

func (s *MemoryStore) Get(_ context.Context, retainedID string) (Record, error)

func (*MemoryStore) List

func (s *MemoryStore) List(_ context.Context, req ListRequest) ([]Record, error)

func (*MemoryStore) MarkBound

func (s *MemoryStore) MarkBound(_ context.Context, req BindRequest) (Record, error)

func (*MemoryStore) MarkDeleteFailed

func (s *MemoryStore) MarkDeleteFailed(_ context.Context, req DeleteFailedRequest) (Record, error)

func (*MemoryStore) MarkDeleted

func (s *MemoryStore) MarkDeleted(_ context.Context, req DeleteRequest) (Record, error)

func (*MemoryStore) Retain

func (s *MemoryStore) Retain(_ context.Context, req RetainRequest) (Record, error)

func (*MemoryStore) Touch

func (s *MemoryStore) Touch(_ context.Context, req TouchRequest) (Record, error)

type Record

type Record struct {
	RetainedID             string            `json:"retained_id"`
	SourcePluginInstanceID string            `json:"source_plugin_instance_id"`
	BoundPluginInstanceID  string            `json:"bound_plugin_instance_id,omitempty"`
	PublisherID            string            `json:"publisher_id"`
	PluginID               string            `json:"plugin_id"`
	Version                string            `json:"version"`
	PackageHash            string            `json:"package_hash"`
	ManifestHash           string            `json:"manifest_hash"`
	State                  State             `json:"state"`
	StorageRetained        bool              `json:"storage_retained"`
	SettingsRetained       bool              `json:"settings_retained"`
	UsageBytes             int64             `json:"usage_bytes,omitempty"`
	DeleteAfter            *time.Time        `json:"delete_after,omitempty"`
	DeleteError            string            `json:"delete_error,omitempty"`
	Metadata               map[string]string `json:"metadata,omitempty"`
	RetainedAt             time.Time         `json:"retained_at"`
	UpdatedAt              time.Time         `json:"updated_at"`
	BoundAt                *time.Time        `json:"bound_at,omitempty"`
	DeletedAt              *time.Time        `json:"deleted_at,omitempty"`
	LastAccessedAt         *time.Time        `json:"last_accessed_at,omitempty"`
}

type RetainRequest

type RetainRequest struct {
	RetainedID             string            `json:"retained_id"`
	SourcePluginInstanceID string            `json:"source_plugin_instance_id"`
	PublisherID            string            `json:"publisher_id"`
	PluginID               string            `json:"plugin_id"`
	Version                string            `json:"version"`
	PackageHash            string            `json:"package_hash"`
	ManifestHash           string            `json:"manifest_hash"`
	StorageRetained        bool              `json:"storage_retained"`
	SettingsRetained       bool              `json:"settings_retained"`
	UsageBytes             int64             `json:"usage_bytes,omitempty"`
	DeleteAfter            *time.Time        `json:"delete_after,omitempty"`
	Metadata               map[string]string `json:"metadata,omitempty"`
	Now                    time.Time         `json:"now,omitempty"`
}

type SQLiteStore

type SQLiteStore struct {
	// contains filtered or unexported fields
}

func NewSQLiteStore

func NewSQLiteStore(ctx context.Context, path string) (*SQLiteStore, error)

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) Delete

func (s *SQLiteStore) Delete(ctx context.Context, retainedID string) error

func (*SQLiteStore) ExpireBefore

func (s *SQLiteStore) ExpireBefore(ctx context.Context, now time.Time) ([]Record, error)

func (*SQLiteStore) Get

func (s *SQLiteStore) Get(ctx context.Context, retainedID string) (Record, error)

func (*SQLiteStore) List

func (s *SQLiteStore) List(ctx context.Context, req ListRequest) ([]Record, error)

func (*SQLiteStore) MarkBound

func (s *SQLiteStore) MarkBound(ctx context.Context, req BindRequest) (Record, error)

func (*SQLiteStore) MarkDeleteFailed

func (s *SQLiteStore) MarkDeleteFailed(ctx context.Context, req DeleteFailedRequest) (Record, error)

func (*SQLiteStore) MarkDeleted

func (s *SQLiteStore) MarkDeleted(ctx context.Context, req DeleteRequest) (Record, error)

func (*SQLiteStore) Retain

func (s *SQLiteStore) Retain(ctx context.Context, req RetainRequest) (Record, error)

func (*SQLiteStore) Touch

func (s *SQLiteStore) Touch(ctx context.Context, req TouchRequest) (Record, error)

type State

type State string
const (
	StateRetained              State = "retained"
	StateExpired               State = "expired"
	StateBound                 State = "bound"
	StateDeleted               State = "deleted"
	StateDeleteFailedRetryable State = "delete_failed_retryable"
)

type Store

type Store interface {
	Retain(ctx context.Context, req RetainRequest) (Record, error)
	Get(ctx context.Context, retainedID string) (Record, error)
	List(ctx context.Context, req ListRequest) ([]Record, error)
	MarkBound(ctx context.Context, req BindRequest) (Record, error)
	MarkDeleted(ctx context.Context, req DeleteRequest) (Record, error)
	MarkDeleteFailed(ctx context.Context, req DeleteFailedRequest) (Record, error)
	Touch(ctx context.Context, req TouchRequest) (Record, error)
	ExpireBefore(ctx context.Context, now time.Time) ([]Record, error)
	Delete(ctx context.Context, retainedID string) error
}

type TouchRequest

type TouchRequest struct {
	RetainedID string    `json:"retained_id"`
	Now        time.Time `json:"now,omitempty"`
}

Jump to

Keyboard shortcuts

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