sqlite

package
v0.0.0-...-dc8f43e Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package sqlite implements a SQLite-backed datastore for govc. This provides persistent storage with good performance for small to medium deployments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *sql.DB) error

Migrate runs all pending migrations

func Rollback

func Rollback(db *sql.DB, targetVersion int) error

Rollback rolls back to a specific version

Types

type Migration

type Migration struct {
	Version     int
	Description string
	Up          string
	Down        string
}

Migration represents a database migration

type SQLiteStore

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

SQLiteStore implements datastore.DataStore using SQLite

func New

func New(config datastore.Config) (*SQLiteStore, error)

New creates a new SQLite store

func (*SQLiteStore) BeginTx

BeginTx begins a transaction

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

Close closes the SQLite store

func (*SQLiteStore) CountEvents

func (s *SQLiteStore) CountEvents(filter datastore.EventFilter) (int64, error)

CountEvents counts audit events

func (*SQLiteStore) CountObjects

func (s *SQLiteStore) CountObjects() (int64, error)

CountObjects returns the total number of objects

func (*SQLiteStore) DeleteConfig

func (s *SQLiteStore) DeleteConfig(key string) error

DeleteConfig deletes a configuration key

func (*SQLiteStore) DeleteObject

func (s *SQLiteStore) DeleteObject(hash string) error

DeleteObject deletes an object

func (*SQLiteStore) DeleteObjects

func (s *SQLiteStore) DeleteObjects(hashes []string) error

DeleteObjects deletes multiple objects at once

func (*SQLiteStore) DeleteRef

func (s *SQLiteStore) DeleteRef(repoID string, name string) error

DeleteRef deletes a reference

func (*SQLiteStore) DeleteRepository

func (s *SQLiteStore) DeleteRepository(id string) error

DeleteRepository deletes a repository

func (*SQLiteStore) DeleteUser

func (s *SQLiteStore) DeleteUser(id string) error

DeleteUser deletes a user

func (*SQLiteStore) GetAllConfig

func (s *SQLiteStore) GetAllConfig() (map[string]string, error)

GetAllConfig retrieves all configuration

func (*SQLiteStore) GetConfig

func (s *SQLiteStore) GetConfig(key string) (string, error)

GetConfig retrieves a configuration value

func (*SQLiteStore) GetMetrics

func (s *SQLiteStore) GetMetrics() datastore.Metrics

GetMetrics returns store metrics

func (*SQLiteStore) GetObject

func (s *SQLiteStore) GetObject(hash string) ([]byte, error)

GetObject retrieves an object by hash

func (*SQLiteStore) GetObjectSize

func (s *SQLiteStore) GetObjectSize(hash string) (int64, error)

GetObjectSize returns the size of an object

func (*SQLiteStore) GetObjects

func (s *SQLiteStore) GetObjects(hashes []string) (map[string][]byte, error)

GetObjects retrieves multiple objects at once

func (*SQLiteStore) GetRef

func (s *SQLiteStore) GetRef(repoID string, name string) (*datastore.Reference, error)

GetRef retrieves a reference

func (*SQLiteStore) GetRepository

func (s *SQLiteStore) GetRepository(id string) (*datastore.Repository, error)

GetRepository retrieves a repository by ID

func (*SQLiteStore) GetStorageSize

func (s *SQLiteStore) GetStorageSize() (int64, error)

GetStorageSize returns the total storage size used

func (*SQLiteStore) GetUser

func (s *SQLiteStore) GetUser(id string) (*datastore.User, error)

GetUser retrieves a user by ID

func (*SQLiteStore) GetUserByUsername

func (s *SQLiteStore) GetUserByUsername(username string) (*datastore.User, error)

GetUserByUsername retrieves a user by username

func (*SQLiteStore) HasObject

func (s *SQLiteStore) HasObject(hash string) (bool, error)

HasObject checks if an object exists

func (*SQLiteStore) HealthCheck

func (s *SQLiteStore) HealthCheck(ctx context.Context) error

HealthCheck checks if the store is healthy

func (*SQLiteStore) Info

func (s *SQLiteStore) Info() map[string]interface{}

Info returns store information

func (*SQLiteStore) Initialize

func (s *SQLiteStore) Initialize(config datastore.Config) error

Initialize initializes the SQLite store

func (*SQLiteStore) IterateObjects

func (s *SQLiteStore) IterateObjects(prefix string, fn func(hash string, data []byte) error) error

IterateObjects iterates over all objects

func (*SQLiteStore) ListObjects

func (s *SQLiteStore) ListObjects(prefix string, limit int) ([]string, error)

ListObjects lists objects with optional prefix filtering

func (*SQLiteStore) ListRefs

func (s *SQLiteStore) ListRefs(repoID string, refType datastore.RefType) ([]*datastore.Reference, error)

ListRefs lists references for a repository

func (*SQLiteStore) ListRepositories

func (s *SQLiteStore) ListRepositories(filter datastore.RepositoryFilter) ([]*datastore.Repository, error)

ListRepositories lists repositories with filtering

func (*SQLiteStore) ListUsers

func (s *SQLiteStore) ListUsers(filter datastore.UserFilter) ([]*datastore.User, error)

ListUsers lists users with filtering

func (*SQLiteStore) LogEvent

func (s *SQLiteStore) LogEvent(event *datastore.AuditEvent) error

LogEvent logs an audit event

func (*SQLiteStore) MetadataStore

func (s *SQLiteStore) MetadataStore() datastore.MetadataStore

MetadataStore returns the metadata store interface

func (*SQLiteStore) ObjectStore

func (s *SQLiteStore) ObjectStore() datastore.ObjectStore

ObjectStore returns the object store interface

func (*SQLiteStore) PutObject

func (s *SQLiteStore) PutObject(hash string, data []byte) error

PutObject stores an object

func (*SQLiteStore) PutObjects

func (s *SQLiteStore) PutObjects(objects map[string][]byte) error

PutObjects stores multiple objects at once

func (*SQLiteStore) QueryEvents

func (s *SQLiteStore) QueryEvents(filter datastore.EventFilter) ([]*datastore.AuditEvent, error)

QueryEvents queries audit events

func (*SQLiteStore) SaveRef

func (s *SQLiteStore) SaveRef(repoID string, ref *datastore.Reference) error

SaveRef saves a reference

func (*SQLiteStore) SaveRepository

func (s *SQLiteStore) SaveRepository(repo *datastore.Repository) error

SaveRepository saves a repository

func (*SQLiteStore) SaveUser

func (s *SQLiteStore) SaveUser(user *datastore.User) error

SaveUser saves a user

func (*SQLiteStore) SetConfig

func (s *SQLiteStore) SetConfig(key string, value string) error

SetConfig sets a configuration value

func (*SQLiteStore) Type

func (s *SQLiteStore) Type() string

Type returns the store type

func (*SQLiteStore) UpdateRef

func (s *SQLiteStore) UpdateRef(repoID string, name string, newHash string) error

UpdateRef updates a reference hash

func (*SQLiteStore) UpdateRepository

func (s *SQLiteStore) UpdateRepository(id string, updates map[string]interface{}) error

UpdateRepository updates a repository

func (*SQLiteStore) UpdateUser

func (s *SQLiteStore) UpdateUser(id string, updates map[string]interface{}) error

UpdateUser updates a user

func (*SQLiteStore) Vacuum

func (s *SQLiteStore) Vacuum() error

Vacuum optimizes the database

Jump to

Keyboard shortcuts

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