Documentation ¶
Overview ¶
This package defines the Store interfaces for reading and writing bundles (or any artifact data) to some underlying system, and Store implementations.
Index ¶
- Constants
- Variables
- func GetDurationTTL(t *TTLValue) time.Duration
- func MakePesterClient() *pester.Client
- type Client
- type FakeStore
- type FileStore
- type GroupcacheConfig
- type NoopStore
- type PeerFetcher
- type Resource
- type Store
- type StoreConfig
- type StoreRead
- type StoreWrite
- type TTLConfig
- type TTLValue
Constants ¶
const ( // DefaultTTLKey is primarily used for communicating ttl(RFC1123) over http. DefaultTTLKey string = "x-scoot-expires" // DefaultTTLFormat is to specify the format for parsing ttl(RFC1123). DefaultTTLFormat string = time.RFC1123 )
const DefaultHttpTries = 7 // ~2min total of trying with exponential backoff (0 and 1 both mean 1 try total)
Variables ¶
var DefaultTTL time.Duration = time.Hour * 24 * 180 //180 days. If zero, no ttl will be applied by default.
Functions ¶
func GetDurationTTL ¶
Return a time.Duration based on Now given a TTLValue specifying a fixed time. Returns a zero duration if TTLValue is nil or if duration would be negative.
func MakePesterClient ¶
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
func MakeFileStore ¶
func MakeFileStoreInTemp ¶
Create a fixed dir in tmp. Note: this implementation does not currently support TTL.
type GroupcacheConfig ¶
type GroupcacheConfig struct { Name string Memory_bytes int64 AddrSelf string Endpoint string NodeReqCh cluster.NodeReqChType }
Note: Endpoint is concatenated with Name in groupcache internals, and AddrSelf is expected as HOST:PORT.
type NoopStore ¶
type NoopStore struct { }
Implements Store with no actions being taken on any methods.
type PeerFetcher ¶
Called periodically in a goroutine. Must include the current instance among the fetched nodes.
type Resource ¶
type Resource struct { io.ReadCloser Length int64 TTLValue *TTLValue }
Resource encapsulates a Store resource and embeds an io.ReadCloser around the data Length: length in bytes of data to be read or written TTLValue: TTL value for the resource, or nil if not supporting TTL
func NewResource ¶
func NewResource(rc io.ReadCloser, l int64, ttlv *TTLValue) *Resource
NewResource constructs a new resource.
type Store ¶
type Store interface { StoreRead StoreWrite }
Combines read and write operations on store. This is what most of the code will use.
func MakeCustomHTTPStore ¶
func MakeGroupcacheStore ¶
func MakeGroupcacheStore(underlying Store, cfg *GroupcacheConfig, ttlc *TTLConfig, stat stats.StatsReceiver) (Store, http.Handler, error)
Add in-memory caching to the given store.
func MakeHTTPStore ¶
type StoreConfig ¶
type StoreConfig struct { Store Store TTLCfg *TTLConfig Stat stats.StatsReceiver }
Encapsulating struct for instances of Stores and accompanying configurations
type StoreRead ¶
type StoreRead interface { // Check if the bundle exists. Not guaranteed to be any cheaper than actually reading the bundle. Exists(name string) (bool, error) // Open the bundle for streaming read. It is the caller's responsibility to call Close(). OpenForRead(name string) (*Resource, error) // Get the base location, like a directory or base URI that the Store writes to Root() string }
Read-only operations on store, limited for now to a couple essential functions.
type StoreWrite ¶
type StoreWrite interface { // Does a streaming write of the given bundle. There is no concept of partial writes (partial=failed). Write(name string, resource *Resource) error }
Write operations on store, limited to a one-shot writing operation since bundles are immutable. If ttl config is nil then the store will use its defaults.