server

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Overview

Package server implements a cache server

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRequest = errors.New("invalid request") //nolint:revive

Functions

func NewCacheServer

func NewCacheServer(config CacheServerConfig) http.Handler

NewCacheServer returns a CacheServer backed by a cache

Types

type CacheServer

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

CacheServer implements an http server that handles cache requests

func (*CacheServer) Download

func (s *CacheServer) Download(w http.ResponseWriter, r *http.Request)

Download returns an object's content given its id

func (*CacheServer) Get

func (s *CacheServer) Get(w http.ResponseWriter, r *http.Request)

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

func (*CacheServer) Store

func (s *CacheServer) Store(w http.ResponseWriter, r *http.Request)

Store stores the object and returns the metadata

type CacheServerConfig

type CacheServerConfig struct {
	BaseURL string
	Cache   cache.Cache
	Log     *slog.Logger
}

CacheServerConfig defines the configuration for the APIServer

Jump to

Keyboard shortcuts

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