staticdb

package
v0.0.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LogError string = "ERROR"
	LogInfo  string = "INFO"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	ID      string `db:"id"`
	Payload []byte `db:"payload"`
}

events table

type Log

type Log struct {
	ID      uint64 `db:"id"`
	Level   string `db:"level"`
	Date    int64  `db:"date"`
	Message string `db:"message"`
}

type LogDB

type LogDB struct {
	*sqlite.DB
}

func OpenLogDB

func OpenLogDB(ctx context.Context, bucket *blob.Bucket, dataDir string, repository string) (*LogDB, error)

func (*LogDB) AddLog

func (db *LogDB) AddLog(ctx context.Context, level string, message string) error

func (*LogDB) WalkLogs

func (db *LogDB) WalkLogs(ctx context.Context, walkFn WalkLogFunc) error

type RepositoryDB

type RepositoryDB struct {
	*sqlite.DB
}

func OpenRepositoryDB

func OpenRepositoryDB(ctx context.Context, bucket *blob.Bucket, dataDir string, repository string) (*RepositoryDB, error)

func (*RepositoryDB) AddFile

func (db *RepositoryDB) AddFile(ctx context.Context, file *RepositoryFile) error

func (*RepositoryDB) GetFileByName

func (db *RepositoryDB) GetFileByName(ctx context.Context, name string) (*RepositoryFile, error)

func (*RepositoryDB) GetFileByTag

func (db *RepositoryDB) GetFileByTag(ctx context.Context, tag string) (*RepositoryFile, error)

func (*RepositoryDB) RemoveFile

func (db *RepositoryDB) RemoveFile(ctx context.Context, tag string) (bool, error)

func (*RepositoryDB) WalkFiles

func (db *RepositoryDB) WalkFiles(ctx context.Context, walkFn WalkFileFunc) error

type RepositoryFile

type RepositoryFile struct {
	Tag        string `db:"tag"`
	ID         string `db:"id"`
	Name       string `db:"name"`
	UploadTime int64  `db:"upload_time"`
	Size       uint64 `db:"size"`
}

type StatusDB

type StatusDB struct {
	*sqlite.DB
}

func OpenStatusDB

func OpenStatusDB(ctx context.Context, bucket *blob.Bucket, dataDir string, repository string) (*StatusDB, error)

func (*StatusDB) AddEvent

func (db *StatusDB) AddEvent(ctx context.Context, event *eventv1.EventPayload) error

func (*StatusDB) CountEnvents

func (db *StatusDB) CountEnvents(ctx context.Context) (int, error)

func (*StatusDB) RemoveEvent

func (db *StatusDB) RemoveEvent(ctx context.Context, event *eventv1.EventPayload) error

func (*StatusDB) WalkEvents

func (db *StatusDB) WalkEvents(ctx context.Context, walkFn WalkEventsFunc) error

type WalkEventsFunc

type WalkEventsFunc func(*eventv1.EventPayload) error

type WalkFileFunc

type WalkFileFunc func(*RepositoryFile) error

type WalkLogFunc

type WalkLogFunc func(*Log) error

Jump to

Keyboard shortcuts

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