database

package
v0.0.0-...-33abfaa Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const V1Schema = `` /* 464-byte string literal not displayed */

Variables

View Source
var SchemaUnknownVersionError = errors.New("unable to find the version key")
View Source
var SchemaUnsupportedVersionError = errors.New("database version is unsupported")

Functions

func CreateDatabaseIfNotExists

func CreateDatabaseIfNotExists(path string) error

CreateDatabaseIfNotExists creates an Repositron database at a given path if it is not configured.

Types

type DatabaseSchemaVersion

type DatabaseSchemaVersion int

DatabaseSchemaVersion describes which version of the database format is in use.

const (
	DbSchemaInvalid DatabaseSchemaVersion = 0
	DbSchemaV1      DatabaseSchemaVersion = 1
)

func GetDatabaseSchemaVersion

func GetDatabaseSchemaVersion(path string) (DatabaseSchemaVersion, error)

GetDatabaseSchemaVersion checks that the Repositron database being used is the right version.

type KeyValueConfig

type KeyValueConfig struct {
	Key   string `db_name:"key"`
	Value string `db_name:"value"`
}

func GetConfigurationValue

func GetConfigurationValue(key string, db *sqlx.DB) (*KeyValueConfig, error)

func GetConfigurationValues

func GetConfigurationValues(db *sqlx.DB) ([]KeyValueConfig, error)

type Store

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

func CreateStore

func CreateStore(path string) (*Store, error)

CreateStore generates or opens a blob store.

func (*Store) Close

func (s *Store) Close() error

Close disposes of the store and any underlying resources.

func (*Store) DeleteBlobById

func (s *Store) DeleteBlobById(id int64) error

DeleteBlobById deletes a record.

func (*Store) EstimateSizeOfManagedContent

func (s *Store) EstimateSizeOfManagedContent() (int64, error)

EstimateSizeOfManagedContent returns a summary of the size of all blobs store din the database.

func (*Store) FinalizeBlobRecord

func (s *Store) FinalizeBlobRecord(blob *models.Blob) (*models.Blob, error)

FinalizeBlobRecord completes a blob and records all fields.

func (*Store) GetAllBuckets

func (s *Store) GetAllBuckets() ([]string, error)

GetAllBuckets retrieves a list of all the available buckets

func (*Store) GetBlobIdsMatchingBucket

func (s *Store) GetBlobIdsMatchingBucket(bucket string) ([]int64, error)

GetBlobIdsMatchingBucket retrieves a list of blobs which match a bucket.

func (*Store) GetBlobIdsMatchingChecksum

func (s *Store) GetBlobIdsMatchingChecksum(checksum string) ([]int64, error)

GetBlobIdsMatchingChecksum retrieves a list of blobs which match a given SHA1.

func (*Store) GetBlobIdsMatchingName

func (s *Store) GetBlobIdsMatchingName(name string) ([]int64, error)

GetBlobIdsMatchingName retrieves a list of blobs which match a name.

func (*Store) RetrieveBlobById

func (s *Store) RetrieveBlobById(id int64) (*models.Blob, error)

RetrieveBlobById returns a blob record from the database with a given ID.

func (*Store) StoreBlobRecord

func (s *Store) StoreBlobRecord(blob *models.Blob) (*models.Blob, error)

StoreBlobRecord inserts a WIP-blob into the database and allocates an id. Specifically, it stores the name, bucket, class, uploader, and metadata.

Jump to

Keyboard shortcuts

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