sqlite

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const InitialSchema = `` /* 3224-byte string literal not displayed */

InitialSchema creates the initial SQLite database schema

View Source
const SchemaVersion = 1

Variables

View Source
var Migrations = []string{
	InitialSchema,
}

Migrations is a list of all schema migrations

Functions

func NewSQLiteStorage

func NewSQLiteStorage(dbPath string, logger *zap.Logger) (types.ApplicationStore, error)

NewSQLiteStorage creates a new SQLite storage instance

Types

type Factory

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

Factory implements ApplicationStoreFactory and creates storage components backed by SQLite.

func NewFactory

func NewFactory(dbPath string) *Factory

NewFactory creates a new Factory with the given database path.

func (*Factory) Close

func (f *Factory) Close() error

Close implements storage.Closer

func (*Factory) CreateApplicationStore

func (f *Factory) CreateApplicationStore() (types.ApplicationStore, error)

CreateApplicationStore implements storage.ApplicationStoreFactory

func (*Factory) Initialize

func (f *Factory) Initialize(logger *zap.Logger) error

Initialize implements storage.ApplicationStoreFactory

func (*Factory) Purge

func (f *Factory) Purge(ctx context.Context) error

Purge removes all data from the Factory's underlying SQLite store. This function is intended for testing purposes only and should not be used in production environments.

type Storage

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

Storage implements the ApplicationStore interface using SQLite

func (*Storage) Close

func (s *Storage) Close() error

Close closes the database connection

func (*Storage) CreateAgent

func (s *Storage) CreateAgent(ctx context.Context, agent *types.Agent) error

Agent management

func (*Storage) CreateConfig

func (s *Storage) CreateConfig(ctx context.Context, config *types.Config) error

Config management

func (*Storage) CreateGroup

func (s *Storage) CreateGroup(ctx context.Context, group *types.Group) error

Group management

func (*Storage) DeleteAgent

func (s *Storage) DeleteAgent(ctx context.Context, id uuid.UUID) error

func (*Storage) DeleteGroup

func (s *Storage) DeleteGroup(ctx context.Context, id string) error

func (*Storage) GetAgent

func (s *Storage) GetAgent(ctx context.Context, id uuid.UUID) (*types.Agent, error)

func (*Storage) GetConfig

func (s *Storage) GetConfig(ctx context.Context, id string) (*types.Config, error)

func (*Storage) GetGroup

func (s *Storage) GetGroup(ctx context.Context, id string) (*types.Group, error)

func (*Storage) GetLatestConfigForAgent

func (s *Storage) GetLatestConfigForAgent(ctx context.Context, agentID uuid.UUID) (*types.Config, error)

func (*Storage) GetLatestConfigForGroup

func (s *Storage) GetLatestConfigForGroup(ctx context.Context, groupID string) (*types.Config, error)

func (*Storage) ListAgents

func (s *Storage) ListAgents(ctx context.Context) ([]*types.Agent, error)

func (*Storage) ListConfigs

func (s *Storage) ListConfigs(ctx context.Context, filter types.ConfigFilter) ([]*types.Config, error)

func (*Storage) ListGroups

func (s *Storage) ListGroups(ctx context.Context) ([]*types.Group, error)

func (*Storage) UpdateAgentEffectiveConfig

func (s *Storage) UpdateAgentEffectiveConfig(ctx context.Context, id uuid.UUID, effectiveConfig string) error

func (*Storage) UpdateAgentLastSeen

func (s *Storage) UpdateAgentLastSeen(ctx context.Context, id uuid.UUID, lastSeen time.Time) error

func (*Storage) UpdateAgentStatus

func (s *Storage) UpdateAgentStatus(ctx context.Context, id uuid.UUID, status types.AgentStatus) error

Jump to

Keyboard shortcuts

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