Documentation ¶
Index ¶
- Constants
- Variables
- type CondCheck
- func (z *CondCheck) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *CondCheck) EncodeMsg(en *msgp.Writer) (err error)
- func (r *CondCheck) Init(bucket, object string, header http.Header)
- func (r *CondCheck) IsSet() bool
- func (z *CondCheck) MarshalMsg(b []byte) (o []byte, err error)
- func (z *CondCheck) Msgsize() (s int)
- func (z *CondCheck) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Config
- type ObjectInfo
- func (z *ObjectInfo) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *ObjectInfo) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ObjectInfo) MarshalMsg(b []byte) (o []byte, err error)
- func (z *ObjectInfo) Msgsize() (s int)
- func (z *ObjectInfo) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (oi ObjectInfo) WriteHeaders(w http.ResponseWriter, preamble, statusCode func())
Constants ¶
const ( Enable = "enable" Endpoint = "endpoint" BlockSize = "block_size" EnvEnable = "MINIO_CACHE_ENABLE" EnvEndpoint = "MINIO_CACHE_ENDPOINT" EnvBlockSize = "MINIO_CACHE_BLOCK_SIZE" )
Cache related keys
Variables ¶
var ( ErrInvalidArgument = errors.New("invalid argument") ErrKeyMissing = errors.New("key is missing") )
cache related errors
var DefaultKVS = config.KVS{ config.KV{ Key: Enable, Value: "off", }, config.KV{ Key: Endpoint, Value: "", }, config.KV{ Key: BlockSize, Value: "", }, }
DefaultKVS - default KV config for cache settings
var ( // Help - provides help for cache config Help = config.HelpKVS{ config.HelpKV{ Key: Enable, Type: "on|off", Description: "set to enable remote cache plugin" + defaultHelpPostfix(Enable), Optional: true, }, config.HelpKV{ Key: Endpoint, Type: "string", Description: "remote cache endpoint for GET/HEAD object(s) metadata, data" + defaultHelpPostfix(Endpoint), Optional: true, }, config.HelpKV{ Key: BlockSize, Type: "string", Description: "cache all objects below the specified block size" + defaultHelpPostfix(BlockSize), Optional: true, }, } )
Functions ¶
This section is empty.
Types ¶
type CondCheck ¶
type CondCheck struct { ObjectInfo IfMatch string `json:"ifMatch,omitempty" msg:",omitempty"` IfNoneMatch string `json:"ifNoneMatch,omitempty" msg:",omitempty"` IfModifiedSince *time.Time `json:"ifModSince,omitempty" msg:",omitempty"` IfUnModifiedSince *time.Time `json:"ifUnmodSince,omitempty" msg:",omitempty"` IfRange string `json:"ifRange,omitempty" msg:",omitempty"` IfPartNumber int `json:"ifPartNumber,omitempty" msg:",omitempty"` }
CondCheck represents the conditional request made to the remote cache for validation during GET/HEAD object requests.
func (*CondCheck) Init ¶
Init - populates the input values, initializes CondCheck before sending the request remotely.
func (*CondCheck) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Config ¶
type Config struct { // Flag indicating whether cache is enabled. Enable bool `json:"enable"` // Endpoint for caching uses remote mcache server to // store and retrieve pre-condition check entities such as // Etag and ModTime of an object + version Endpoint string `json:"endpoint"` // BlockSize indicates the maximum object size below which // data is cached and fetched remotely from DRAM. BlockSize int64 // contains filtered or unexported fields }
Config represents the subnet related configuration
func LookupConfig ¶
LookupConfig - lookup config and override with valid environment settings if any.
func (Config) Get ¶
func (c Config) Get(r *CondCheck) (*ObjectInfo, error)
Get performs conditional check and returns the cached object info if any.
func (Config) MatchesSize ¶
MatchesSize verifies if input 'size' falls under cacheable threshold
type ObjectInfo ¶
type ObjectInfo struct { Key string `json:"key"` Bucket string `json:"bucket"` ETag string `json:"etag"` ModTime time.Time `json:"modTime"` StatusCode int `json:"statusCode"` // Optional elements CacheControl string `json:"cacheControl,omitempty" msg:",omitempty"` Expires string `json:"expires,omitempty" msg:",omitempty"` Metadata map[string]string `json:"metadata,omitempty" msg:",omitempty"` Range string `json:"range,omitempty" msg:",omitempty"` PartNumber int `json:"partNumber,omitempty" msg:",omitempty"` Size int64 `json:"size,omitempty" msg:",omitempty"` // Full size of the object Data []byte `json:"data,omitempty" msg:",omitempty"` // Data can container full data of the object or partial }
ObjectInfo represents the object information cached remotely
func (*ObjectInfo) DecodeMsg ¶
func (z *ObjectInfo) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*ObjectInfo) EncodeMsg ¶
func (z *ObjectInfo) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ObjectInfo) MarshalMsg ¶
func (z *ObjectInfo) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*ObjectInfo) Msgsize ¶
func (z *ObjectInfo) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ObjectInfo) UnmarshalMsg ¶
func (z *ObjectInfo) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
func (ObjectInfo) WriteHeaders ¶
func (oi ObjectInfo) WriteHeaders(w http.ResponseWriter, preamble, statusCode func())
WriteHeaders writes the response headers for conditional requests