gcache

package
v0.0.0-...-128520e Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(url string, headers map[string]string) ([]byte, error)

func NewCache

func NewCache(config Config) hydrator.Cache

func NewLazyReader

func NewLazyReader(reader io.ReaderAt, start, end, blockSize int64) io.ReadSeeker

func NewMetadataSyncer

func NewMetadataSyncer(cache MetadataCache, c *clientv3.Client) error

Types

type Config

type Config struct {
	MaxMemoryUsage int64
	BlockSize      int64
	DiskCache      diskcache.Cache
	Hydrator       hydrator.Hydrator
	GroupName      string
	PeeringAddress string
	Etcd           []string
	PassThrough    []string
}

type Key

type Key struct {
	// required
	Url string

	// required if present
	ContentLength   uint64 `json:",omitempty"`
	ContentEncoding string `json:",omitempty"`

	// require only first.
	// last retrieved used as fallback
	// if last retrieved is set, always set to time.Now() to force expiration
	Etag          string `json:",omitempty"`
	Sha512        string `json:",omitempty"`
	Sha256        string `json:",omitempty"`
	Sha1          string `json:",omitempty"`
	Md5           string `json:",omitempty"`
	LastModified  string `json:",omitempty"`
	LastRetrieved string `json:",omitempty"`
}

type MetadataCache

type MetadataCache interface {
	Add(key string, cacheEntry hydrator.CacheEntry) error
	AddWithoutSync(key string, metadata hydrator.CacheEntry)
	Get(key string, clientHeaders http.Header) (*hydrator.CacheEntry, bool)
	Remove(key string)
	RemoveWithoutSync(key string)
	AddSync(syncer MetadataSyncer)
}

func NewMetadataCache

func NewMetadataCache() MetadataCache

type MetadataRequest

type MetadataRequest struct {
	Url     string
	Key     string
	Headers map[string]string
}

type MetadataSyncer

type MetadataSyncer interface {
	Add(key string, value hydrator.CacheEntry) error
	Remove(key string) error
	Sync()
}

type NotCacheable

type NotCacheable struct{}

func (NotCacheable) Error

func (_ NotCacheable) Error() string

type WriterReadSeeker

type WriterReadSeeker interface {
	io.ReadSeeker
	io.WriterTo
}

Jump to

Keyboard shortcuts

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