provide go doc comments for exported types and functions
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
type disk string
|
||||
|
||||
// Disk returns a local disk cache that stores files within a given directory.
|
||||
func Disk(dir string) Store { return disk(dir) }
|
||||
|
||||
func (d disk) Put(ctx context.Context, snapshot Snapshot) error {
|
||||
|
||||
@@ -13,6 +13,7 @@ type memory struct {
|
||||
cache []Snapshot
|
||||
}
|
||||
|
||||
// Memory creates an in-memory cache.
|
||||
func Memory() Store { return &memory{} }
|
||||
|
||||
func (m *memory) Put(ctx context.Context, snapshot Snapshot) error {
|
||||
|
||||
@@ -7,12 +7,15 @@ import (
|
||||
"github.com/sixt/gomodproxy/pkg/vcs"
|
||||
)
|
||||
|
||||
// Store is an interface for a typical cache. It allows to put a snapshot and
|
||||
// to get snapshot of the specific version.
|
||||
type Store interface {
|
||||
Put(ctx context.Context, snapshot Snapshot) error
|
||||
Get(ctx context.Context, module string, version vcs.Version) (Snapshot, error)
|
||||
Close() error
|
||||
}
|
||||
|
||||
// Snapshot is a module source code of the speciic version.
|
||||
type Snapshot struct {
|
||||
Module string
|
||||
Version vcs.Version
|
||||
@@ -20,6 +23,7 @@ type Snapshot struct {
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// Key returns a snapshot key string that can be used in cache stores.
|
||||
func (s Snapshot) Key() string {
|
||||
return s.Module + "@" + string(s.Version)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user