cache

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	BaseURL() *url.URL
	NarinfoCache() NarinfoCache
	Logger() zerolog.Logger
	Storage() storage.Storage
}

type Cache

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

func New

func New(name string, cfg *Config, app App) (*Cache, error)

func (*Cache) HandleCacheInfo

func (c *Cache) HandleCacheInfo(w http.ResponseWriter, r *http.Request)

func (*Cache) HandleCacheNarinfo

func (c *Cache) HandleCacheNarinfo(w http.ResponseWriter, r *http.Request)

func (*Cache) HandleCacheRead

func (c *Cache) HandleCacheRead(w http.ResponseWriter, r *http.Request)

func (*Cache) HandleUploadNar

func (c *Cache) HandleUploadNar(w http.ResponseWriter, r *http.Request)

func (*Cache) HandleUploadNarinfo

func (c *Cache) HandleUploadNarinfo(w http.ResponseWriter, r *http.Request)

func (*Cache) Priority

func (c *Cache) Priority() int8

type Config

type Config struct {
	Priority     *int8               `yaml:"priority,omitempty"`
	Public       *bool               `yaml:"public,omitempty"`
	PrivateKey   PrivateKey          `yaml:"private_key,omitempty"`
	Substituters []ConfigSubstituter `yaml:"substituters,omitempty"`
}

type ConfigSubstituter

type ConfigSubstituter struct {
	URL       string    `yaml:"url,omitempty"`
	PublicKey PublicKey `yaml:"public_key,omitempty"`
}

type NarinfoCache

type NarinfoCache interface {
	Set(key string, entry []byte) error
	Get(key string) ([]byte, error)
}

type PrivateKey

type PrivateKey struct {
	ed25519.PrivateKey
	Identifier string
}

func (PrivateKey) MarshalYAML

func (c PrivateKey) MarshalYAML() (interface{}, error)

func (*PrivateKey) PublicKey

func (c *PrivateKey) PublicKey() PublicKey

func (*PrivateKey) UnmarshalYAML

func (c *PrivateKey) UnmarshalYAML(value *yaml.Node) error

type PublicKey

type PublicKey struct {
	ed25519.PublicKey
	Identifier string
}

func (PublicKey) MarshalYAML

func (c PublicKey) MarshalYAML() (interface{}, error)

func (PublicKey) String

func (c PublicKey) String() string

func (*PublicKey) UnmarshalYAML

func (c *PublicKey) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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