db

package
v0.0.0-...-fcd62ea Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	SchemaVersion = 1
)

Variables

This section is empty.

Functions

func Reset

func Reset(cacheDir string) error

Types

type Client

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

func NewMetadata

func NewMetadata(cacheDir string) Client

func (*Client) Delete

func (c *Client) Delete() error

Delete deletes the file of database metadata

func (*Client) Get

func (c *Client) Get() (Metadata, error)

Get returns the file metadata

func (*Client) Update

func (c *Client) Update(meta Metadata) error

type DB

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

func New

func New(cacheDir string) (DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) Dir

func (db *DB) Dir() string

func (*DB) Init

func (db *DB) Init() error

func (*DB) InsertIndexes

func (db *DB) InsertIndexes(indexes []types.Index) error

func (*DB) SelectIndexByArtifactIDAndGroupID

func (db *DB) SelectIndexByArtifactIDAndGroupID(artifactID, groupID string) (types.Index, error)

func (*DB) SelectIndexBySha1

func (db *DB) SelectIndexBySha1(sha1 string) (types.Index, error)

func (*DB) SelectIndexesByArtifactIDAndFileType

func (db *DB) SelectIndexesByArtifactIDAndFileType(artifactID, version string, fileType types.ArchiveType) ([]types.Index, error)

SelectIndexesByArtifactIDAndFileType returns all indexes for `artifactID` + `fileType` if `version` exists for them

func (*DB) VacuumDB

func (db *DB) VacuumDB() error

type Metadata

type Metadata struct {
	Version      int `json:",omitempty"`
	NextUpdate   time.Time
	UpdatedAt    time.Time
	DownloadedAt time.Time // This field will be filled after downloading.
}

Jump to

Keyboard shortcuts

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