astore

package
v0.0.0-...-5f133c6 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const KindArchitecture = "Arch"
View Source
const KindArtifact = "Artifact"
View Source
const KindPathElement = "Pel"
View Source
const KindPublished = "Pub"

Variables

This section is empty.

Functions

func Commit

func Commit(t **datastore.Transaction) error

func GenerateSid

func GenerateSid(rng *rand.Rand) (string, error)

GenerateSid generates a path where to store the file.

func GenerateUid

func GenerateUid(rng *rand.Rand) (string, error)

GenerateUid generates a unique identifier for the metadata.

func Rollback

func Rollback(t **datastore.Transaction)

Types

type Architecture

type Architecture struct {
	Parent string

	Created time.Time
	Creator string
}

type Artifact

type Artifact struct {
	Uid string
	Sid string
	Tag []string

	MD5  []byte
	Size int64

	Parent  string
	Creator string
	Created time.Time
	Note    string `datastore:",noindex"`
}

func (*Artifact) ToProto

func (af *Artifact) ToProto(arch string) *astore.Artifact

type Flags

type Flags struct {
	Bucket    string
	ProjectID string

	SignatureValidity time.Duration
	PublishBaseURL    string

	ProjectIDJSON       []byte
	SigningConfigJSON   []byte
	CredentialsFileJSON []byte
}

func DefaultFlags

func DefaultFlags() *Flags

func (*Flags) Register

func (f *Flags) Register(set kflags.FlagSet, prefix string) *Flags

type Modifier

type Modifier func(o *Options) error

func WithBucket

func WithBucket(bucket string) Modifier

func WithCredentialsFile

func WithCredentialsFile(path string) Modifier

func WithCredentialsJSON

func WithCredentialsJSON(json []byte) Modifier

func WithFlags

func WithFlags(flags *Flags) Modifier

func WithLogger

func WithLogger(log logger.Logger) Modifier

func WithProjectID

func WithProjectID(prid string) Modifier

func WithProjectIDFile

func WithProjectIDFile(path string) Modifier

func WithProjectIDJSON

func WithProjectIDJSON(data []byte) Modifier

func WithPublishBaseURL

func WithPublishBaseURL(url string) Modifier

func WithSigningConfig

func WithSigningConfig(path string) Modifier

func WithSigningJSON

func WithSigningJSON(data []byte) Modifier

func WithValidity

func WithValidity(d time.Duration) Modifier

type Options

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

func DefaultOptions

func DefaultOptions() Options

func (*Options) ForSigning

func (o *Options) ForSigning(method string) *storage.SignedURLOptions

type PathElement

type PathElement struct {
	Parent string

	Created time.Time
	Creator string
}

type Published

type Published struct {
	Parent  string
	Creator string
	Created time.Time

	// Fields from RetrieveRequest.
	Uid          string
	Path         string
	Architecture string

	// When converting this to a query, no tags vs empty tag array have different meanings:
	// The former indicates that the client specified no tags to filter by.
	// The latter indicates that the client is looking for artifacts with no tags assigned.
	//
	// We flatten the struct here, so we use a bool to differentiate between the two cases.
	HasTags bool
	Tag     []string
}

func FromListRequest

func FromListRequest(req *astore.ListRequest, pub *Published) *Published

func FromRetrieveRequest

func FromRetrieveRequest(req *astore.RetrieveRequest, pub *Published) *Published

func (*Published) ToListRequest

func (pub *Published) ToListRequest() *astore.ListRequest

func (*Published) ToRetrieveRequest

func (pub *Published) ToRetrieveRequest() *astore.RetrieveRequest

type Server

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

func New

func New(rng *rand.Rand, mods ...Modifier) (*Server, error)

func (*Server) Commit

func (*Server) Delete

func (s *Server) Delete(ctx context.Context, request *astore.DeleteRequest) (*astore.DeleteResponse, error)

func (*Server) DownloadArtifact

func (s *Server) DownloadArtifact(prefix string, ehandler DownloadHandler, w http.ResponseWriter, r *http.Request)

DownalodArtifact turns an http.Request into an astore.RetrieveRequest, executes it, and invokes the specified handler with the result.

func (*Server) DownloadPublished

func (s *Server) DownloadPublished(prefix string, ehandler DownloadHandler, w http.ResponseWriter, r *http.Request)

func (*Server) List

func (*Server) ListPublished

func (s *Server) ListPublished(prefix string, ehandler ListHandler, w http.ResponseWriter, r *http.Request)

func (*Server) Note

func (*Server) Publish

func (*Server) Retrieve

func (*Server) Store

func (*Server) Tag

func (*Server) Unpublish

Jump to

Keyboard shortcuts

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