Documentation ¶
Overview ¶
Code generated by /packsql.py -- DO NOT EDIT
Index ¶
- Constants
- Variables
- type Adapter
- func (a *Adapter) ChunksExist(sums []sum.Sum) ([]bool, error)
- func (a *Adapter) DeleteFile(s sum.Sum) error
- func (a *Adapter) DeletePackIndex(sum sum.Sum) error
- func (a *Adapter) GetChunkSize(s sum.Sum) (uint64, error)
- func (a *Adapter) GetFile(s sum.Sum) (object.File, error)
- func (a *Adapter) GetFileChunks(fileID sum.Sum) ([]ChunkIndex, error)
- func (a *Adapter) GetFileInfo(s sum.Sum) (FileInfo, error)
- func (a *Adapter) GetFileVersions(name string, offset int64, limit uint64, ascending bool) ([]FileInfo, error)
- func (a *Adapter) GetLatestFileVersion(name string) (FileInfo, error)
- func (a *Adapter) GetServerStats() (Stats, error)
- func (a *Adapter) GetVacuum(id string) (Vacuum, error)
- func (a *Adapter) GetZeroRefcount(createdBefore time.Time) ([]ZeroRefcount, error)
- func (a *Adapter) InitSchema() error
- func (a *Adapter) InsertFile(file object.File, sum sum.Sum) error
- func (a *Adapter) InsertPackIndex(index object.PackIndex, createdAt time.Time) error
- func (a *Adapter) InsertVacuum(startedAt time.Time) (string, error)
- func (a *Adapter) ListFiles(prefix string, offset int64, limit uint64, exclude string, include string, ...) ([]FileInfo, error)
- func (a *Adapter) UpdateIndex(newIndex object.PackIndex, createdAt time.Time, oldIndexSum sum.Sum, ...) error
- func (a *Adapter) UpdateVacuum(id string, completedAt time.Time, status VacuumStatus) error
- type ChunkIndex
- type FileInfo
- type Stats
- type Vacuum
- type VacuumStatus
- type ZeroRefcount
Constants ¶
const Q_000_Base = `` /* 2024-byte string literal not displayed */
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a row does not exist.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter interfaces with the database.
func EmptyDisk ¶
EmptyDisk returns an adapter to a new database, at the given file location, with all tables created.
func EmptyInMemory ¶
EmptyInMemory returns an adapter to a new in-memory database with all tables created.
func (*Adapter) ChunksExist ¶
ChunksExist checks if chunks, identified by their checksum, exist in the file store. Returns a bool for each chunk.
func (*Adapter) DeleteFile ¶
DeleteFile deletes a file and decrements all chunks referenced by the file by one. Returns ErrNotFound if the file does not exist.
func (*Adapter) DeletePackIndex ¶
DeletePackIndex deletes a pack index from the database.
func (*Adapter) GetChunkSize ¶
GetChunkSize gets the size of a chunk. Returns ErrNotFound if the chunk does not exist.
func (*Adapter) GetFile ¶
GetFile returns a File from the database with a given sum. Returns db.ErrNotFound if the file does not exist.
func (*Adapter) GetFileChunks ¶
func (a *Adapter) GetFileChunks(fileID sum.Sum) ([]ChunkIndex, error)
GetFileChunks returns the packfile location of each chunk in a file. Returns ErrNotFound if the file does not exist.
func (*Adapter) GetFileInfo ¶
GetFileInfo returns the FileInfo for a given file version. Returns ErrNotFound if the file does not exist.
func (*Adapter) GetFileVersions ¶
func (a *Adapter) GetFileVersions(name string, offset int64, limit uint64, ascending bool) ([]FileInfo, error)
GetFileVersions returns the versions of a file with a given name. Pagination is achieved with the offset and limit parameters.
func (*Adapter) GetLatestFileVersion ¶
GetLatestFileVersion returns the latest version of a file with a given name. Returns db.ErrNotFound if the file does not exist.
func (*Adapter) GetServerStats ¶
GetServerStats returns the Stats for the server.
func (*Adapter) GetVacuum ¶
GetVacuum returns the status of a vacuum process with a given ID. Returns db.ErrNotFound if the vacuum does not exist.
func (*Adapter) GetZeroRefcount ¶
func (a *Adapter) GetZeroRefcount(createdBefore time.Time) ([]ZeroRefcount, error)
GetZeroRefcount returns the block sequence numbers in each packfile with a zero refcount.
func (*Adapter) InitSchema ¶
InitSchema creates the tables for a new database.
func (*Adapter) InsertFile ¶
InsertFile saves a File object to the database.
func (*Adapter) InsertPackIndex ¶
InsertPackIndex saves a PackIndex to the database.
func (*Adapter) InsertVacuum ¶
InsertVacuum inserts a row for a new vacuum. Returns the vacuum ID.
func (*Adapter) ListFiles ¶
func (a *Adapter) ListFiles(prefix string, offset int64, limit uint64, exclude string, include string, ascending bool) ([]FileInfo, error)
ListFiles returns a FileInfo slice containing corresponding to files that match the provided prefix. Glob parametrs exclude and include are used to filter the result. Pagination is achieved using the offset and limit parameters. Results are returned in reverse-chronological order by default. Setting ascending to true reverses the order.
func (*Adapter) UpdateIndex ¶
func (a *Adapter) UpdateIndex(newIndex object.PackIndex, createdAt time.Time, oldIndexSum sum.Sum, m map[uint64]uint64) error
UpdateIndex overwrites the contents of a pack index with a new one. The map m specifies the mapping from the sequence numbers of the new index to the sequence numbers of the old index. Any sequences in the old index which are not re-mapped will be deleted when DeletePackIndex is called on the old index.
func (*Adapter) UpdateVacuum ¶
UpdateVacuum updates the status and completed time of a given vacuum.
type ChunkIndex ¶
ChunkIndex is returned by GetFileChunks.
type Stats ¶
type Stats struct { NumFiles uint64 NumFileVersions uint64 TotalFilesSize uint64 TotalDataSize uint64 }
Stats store high-level statistics for the server -- number of file, number of file versions, total size in bytes of all files, and total size of data stored.
type Vacuum ¶
type Vacuum struct { ID string Status VacuumStatus StartedAt int64 // Will be zero if Status is VacuumRunning CompletedAt int64 }
Vacuum is returned by the GetVacuum method.
type VacuumStatus ¶
type VacuumStatus int
VacuumStatus represents the status of a vacuum process.
const ( VacuumRunning VacuumStatus = iota VacuumOK VacuumFailed )
Vacuum status codes
func (VacuumStatus) String ¶
func (s VacuumStatus) String() string
type ZeroRefcount ¶
ZeroRefcount is returned by GetZeroRefcount. It stores a pack ID and a sorted sequence of each block in the file with a zero refcount.