storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Package

type Package struct {
	Name    string `db:"name"`
	Release int    `db:"rel"`
}

Package is Storage's Representation of a Package

type Packages

type Packages []Package

Packages is a sortable type for a list of Package struct

func (Packages) Len

func (pkgs Packages) Len() int

Len returns the length of the list

func (Packages) Less

func (pkgs Packages) Less(i, j int) bool

Less is based on the names of the packages only

func (Packages) Swap

func (pkgs Packages) Swap(i, j int)

Swap switches the packages when sortint

type SqliteStore

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

SqliteStore is a backing store built on sqlite

func (*SqliteStore) Close

func (s *SqliteStore) Close() error

Close deinitializes the connection to the backend store

func (*SqliteStore) DoneToDo

func (s *SqliteStore) DoneToDo(name string, Continue bool) error

DoneToDo marks a package as complete and optionally queues its reverse deps

func (*SqliteStore) GetForward

func (s *SqliteStore) GetForward(lhs string) (Packages, error)

GetForward returns: (lhs) -> *

func (*SqliteStore) GetReverse

func (s *SqliteStore) GetReverse(rhs string) (Packages, error)

GetReverse returns: * -> (rhs)

func (*SqliteStore) GetToDo

func (s *SqliteStore) GetToDo() (Packages, int, int, error)

GetToDo gets the currently unblocked packages to rebuild

func (*SqliteStore) Open

func (s *SqliteStore) Open(location string) error

Open initializes a connection to the backend store

func (*SqliteStore) ResetToDo

func (s *SqliteStore) ResetToDo() error

ResetToDo clears the todo list

func (*SqliteStore) StartToDo

func (s *SqliteStore) StartToDo(name string) error

StartToDo adds a new package to the todo list

func (*SqliteStore) Update

func (s *SqliteStore) Update(i *index.Index) error

Update rebuilds the store from an Index

func (*SqliteStore) WorstToDo

func (s *SqliteStore) WorstToDo(name string) (Packages, error)

WorstToDo gets a worst-case list of packages to rebuild

type Store

type Store interface {
	// Open initializes a connection to the backend store
	Open(location string) error
	// GetForward returns: (left) -> *
	GetForward(lhs string) (Packages, error)
	// GetReverse returns: * -> (right)
	GetReverse(rhs string) (Packages, error)
	// GetToDo returns a list of unblocked packages that need to be rebuilt,
	// the count of remaining rebuilds, and the count of completed rebuilds
	GetToDo() (Packages, int, int, error)
	// StartToDo adds a new package to the todo list
	StartToDo(name string) error
	// DoneToDo marks a package as complete and optionally queues its reverse deps
	DoneToDo(name string, Continue bool) error
	// ResetToDo clears the todo list
	ResetToDo() error
	// WorstToDo gets a worst-case list of packages to rebuild
	WorstToDo(name string) (Packages, error)
	// Update clears the current store and rebuilds the contents from the provided index
	Update(i *index.Index) error
	// Close deinitializes the connection to the backend store
	Close() error
}

Store is a common interface for all kinds of backing store

func NewSqliteStore

func NewSqliteStore() Store

NewSqliteStore gets a new sqlite store

func NewStore

func NewStore() Store

NewStore gets a new version of the current preferred backing store

Jump to

Keyboard shortcuts

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