libstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package libstore implements a subset of the nix libstore API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryCacheReader

type BinaryCacheReader interface {
	FileExists(ctx context.Context, path string) (bool, error)
	GetFile(ctx context.Context, path string) (io.ReadCloser, error)
	URL() string
}

BinaryCacheReader represents a read-only binary cache store

func NewBinaryCacheReader

func NewBinaryCacheReader(ctx context.Context, storeURL string) (BinaryCacheReader, error)

NewBinaryCacheReader parses the storeURL and returns the proper store reader for it.

type GCSBinaryCacheStore

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

GCSBinaryCacheStore ...

func NewGCSBinaryCacheStore

func NewGCSBinaryCacheStore(ctx context.Context, u *url.URL) (*GCSBinaryCacheStore, error)

NewGCSBinaryCacheStore --

func (GCSBinaryCacheStore) FileExists

func (c GCSBinaryCacheStore) FileExists(ctx context.Context, path string) (bool, error)

FileExists returns true if the file is already in the store. err is used for transient issues like networking errors.

func (GCSBinaryCacheStore) GetFile

func (c GCSBinaryCacheStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error)

GetFile returns a file stream from the store if the file exists

func (GCSBinaryCacheStore) URL

func (c GCSBinaryCacheStore) URL() string

URL returns the store URI

type HTTPBinaryCacheStore

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

HTTPBinaryCacheStore ...

func DefaultCache

func DefaultCache() HTTPBinaryCacheStore

DefaultCache points to our beloved https://cache.nixos.org

func NewHTTPBinaryCacheStore

func NewHTTPBinaryCacheStore(u *url.URL) HTTPBinaryCacheStore

NewHTTPBinaryCacheStore ---

func (HTTPBinaryCacheStore) FileExists

func (c HTTPBinaryCacheStore) FileExists(ctx context.Context, path string) (bool, error)

FileExists returns true if the file is already in the store. err is used for transient issues like networking errors.

func (HTTPBinaryCacheStore) GetFile

func (c HTTPBinaryCacheStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error)

GetFile returns a file stream from the store if the file exists

func (HTTPBinaryCacheStore) URL

func (c HTTPBinaryCacheStore) URL() string

URL returns the store URI

type NarInfo

type NarInfo struct {
	StorePath   string
	URL         string
	Compression string
	FileHash    string
	FileSize    int
	NarHash     string
	NarSize     int
	References  []string
	Deriver     string
	System      string
	Signatures  []string
	CA          string
}

NarInfo represent the nar-info format, packed as a struct

func ParseNarInfo

func ParseNarInfo(r io.Reader) (*NarInfo, error)

ParseNarInfo parses the buffer

TODO: parse the FileHash and NarHash to make sure they are valid TODO: validate that the StorePath is valid TODO: validate the references to be valid store paths after being appended to store.storeDir TODO: validate the same for the deriver

func (NarInfo) ContentType

func (n NarInfo) ContentType() string

ContentType returns the mime content type of the object

func (NarInfo) String

func (n NarInfo) String() string

type S3BinaryCacheStore

type S3BinaryCacheStore struct {
	BucketName string
	Client     *s3.S3
	// contains filtered or unexported fields
}

func NewS3BinaryCacheStore

func NewS3BinaryCacheStore(u *url.URL) (*S3BinaryCacheStore, error)

func (*S3BinaryCacheStore) FileExists

func (c *S3BinaryCacheStore) FileExists(ctx context.Context, path string) (bool, error)

func (*S3BinaryCacheStore) GetFile

func (c *S3BinaryCacheStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error)

func (S3BinaryCacheStore) URL

func (c S3BinaryCacheStore) URL() string

URL returns the store URI

Jump to

Keyboard shortcuts

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