client

package
v0.3.5 Latest Latest
Warning

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

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

Documentation

Overview

Package client implements a cache client

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccessingServer = errors.New("making request")        //nolint:revive
	ErrInvalidConfig   = errors.New("invalid configuration") //nolint:revive
	ErrInvalidRequest  = errors.New("invalid request")       //nolint:revive
	ErrInvalidResponse = errors.New("invalid response")      //nolint:revive
	ErrRequestFailed   = errors.New("request failed")        //nolint:revive

)

Functions

This section is empty.

Types

type CacheClient

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

CacheClient access blobs in a CacheServer

func NewCacheClient

func NewCacheClient(config CacheClientConfig) (*CacheClient, error)

NewCacheClient returns a client for a cache server

func (*CacheClient) Download

func (c *CacheClient) Download(_ context.Context, object cache.Object) (io.ReadCloser, error)

Download returns the content of the object given its url

func (*CacheClient) Get

func (c *CacheClient) Get(_ context.Context, id string) (cache.Object, error)

Get retrieves an objects if exists in the cache or an error otherwise

func (*CacheClient) Store

func (c *CacheClient) Store(_ context.Context, id string, content io.Reader) (cache.Object, error)

Store stores the object and returns the metadata

type CacheClientConfig

type CacheClientConfig struct {
	Server string
}

CacheClientConfig defines the configuration for accessing a remote cache service

Jump to

Keyboard shortcuts

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