cache

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cache defines the interface of a cache service

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccessingObject   = errors.New("accessing object")   //nolint:revive
	ErrCreatingObject    = errors.New("creating object")    //nolint:revive
	ErrInitializingCache = errors.New("initializing cache") //nolint:revive
	ErrObjectNotFound    = errors.New("object not found")   //nolint:revive
	ErrInvalidURL        = errors.New("invalid object URL") //nolint:revive

)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Get retrieves an objects if exists in the cache or an error otherwise
	Get(ctx context.Context, id string) (Object, error)
	// Store stores the object and returns the metadata
	Store(ctx context.Context, id string, content io.Reader) (Object, error)
	// Download returns the content of the object
	Download(ctx context.Context, object Object) (io.ReadCloser, error)
}

Cache defines an interface for storing blobs

type Object

type Object struct {
	ID       string
	Checksum string
	// an url for downloading the object's content
	URL string
}

Object represents an object stored in the Cache TODO: add metadata (e.g creation data, size)

func (Object) String

func (o Object) String() string

Directories

Path Synopsis
Package api defines the interface to a cache server
Package api defines the interface to a cache server
Package client implements a cache client
Package client implements a cache client
Package file implements a file-backed cache
Package file implements a file-backed cache
Package server implements a cache server
Package server implements a cache server

Jump to

Keyboard shortcuts

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