mirrordb

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 10 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 Properties

type Properties struct {
	Created       bool   `db:"created"`
	Mirror        bool   `db:"mirror"`
	MirrorConfigs []byte `db:"mirror_configs"`
	WebConfig     []byte `db:"web_config"`
}

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) CountFiles

func (db *RepositoryDB) CountFiles(ctx context.Context) (int, error)

func (*RepositoryDB) DeleteFileByName added in v0.0.32

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

func (*RepositoryDB) GetFileByName

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

func (*RepositoryDB) GetFileByReference added in v0.0.32

func (db *RepositoryDB) GetFileByReference(ctx context.Context, reference 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

func (*RepositoryDB) WalkFilesByConfigID added in v0.0.32

func (db *RepositoryDB) WalkFilesByConfigID(ctx context.Context, configID uint64, walkFn WalkFileFunc) error

func (*RepositoryDB) WalkFilesByDistinctParent added in v0.0.32

func (db *RepositoryDB) WalkFilesByDistinctParent(ctx context.Context, walkFn WalkStringFunc) error

func (*RepositoryDB) WalkFilesByParent added in v0.0.32

func (db *RepositoryDB) WalkFilesByParent(ctx context.Context, parent string, walkFn WalkFileFunc) error
func (db *RepositoryDB) WalkSymlinks(ctx context.Context, walkFn WalkFileFunc) error

type RepositoryFile

type RepositoryFile struct {
	Tag          string `db:"tag"`
	Name         string `db:"name"`
	Reference    string `db:"reference"`
	Parent       string `db:"parent"`
	Link         string `db:"link"`
	ModifiedTime int64  `db:"modified_time"`
	Mode         uint32 `db:"mode"`
	Size         uint64 `db:"size"`
	ConfigID     uint64 `db:"config_id"`
}

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) CountEvents

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

func (*StatusDB) GetProperties

func (db *StatusDB) GetProperties(ctx context.Context) (*Properties, error)

func (*StatusDB) GetSync

func (db *StatusDB) GetSync(ctx context.Context) (*Sync, error)

func (*StatusDB) RemoveEvent

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

func (*StatusDB) SetCreatedProperty

func (db *StatusDB) SetCreatedProperty(ctx context.Context) error

func (*StatusDB) UpdateProperties

func (db *StatusDB) UpdateProperties(ctx context.Context, properties *Properties) error

func (*StatusDB) UpdateSync

func (db *StatusDB) UpdateSync(ctx context.Context, sync *Sync) error

func (*StatusDB) WalkEvents

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

type Sync

type Sync struct {
	Syncing     bool   `db:"syncing"`
	StartTime   int64  `db:"start_time"`
	EndTime     int64  `db:"end_time"`
	TotalFiles  int    `db:"total_files"`
	SyncedFiles int    `db:"synced_files"`
	SyncError   string `db:"sync_error"`
}

type WalkEventsFunc

type WalkEventsFunc func(*eventv1.EventPayload) error

type WalkFileFunc

type WalkFileFunc func(*RepositoryFile) error

type WalkLogFunc

type WalkLogFunc func(*Log) error

type WalkStringFunc added in v0.0.32

type WalkStringFunc func(*string) error

Jump to

Keyboard shortcuts

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