Documentation
¶
Overview ¶
Caching wrappers around GCS to eliminate round trips.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFastStatBucket ¶
func NewFastStatBucket( ttl time.Duration, cache StatCache, clock timeutil.Clock, wrapped gcs.Bucket) (b gcs.Bucket)
Create a bucket that caches object records returned by the supplied wrapped bucket. Records are invalidated when modifications are made through this bucket, and after the supplied TTL.
Types ¶
type StatCache ¶
type StatCache interface { // Insert an entry for the given object record. // // In order to help cope with caching of arbitrarily out of date (i.e. // inconsistent) object listings, entry will not replace any positive entry // with a newer generation number, or with an equivalent generation number // but newer metadata generation number. We have no choice, however, but to // replace negative entries. // // The entry will expire after the supplied time. Insert(o *gcs.Object, expiration time.Time) // Set up a negative entry for the given name, indicating that the name // doesn't exist. Overwrite any existing entry for the name, positive or // negative. AddNegativeEntry(name string, expiration time.Time) // Erase the entry for the given object name, if any. Erase(name string) // Return the current entry for the given name, or nil if there is a negative // entry. Return hit == false when there is neither a positive nor a negative // entry, or the entry has expired according to the supplied current time. LookUp(name string, now time.Time) (hit bool, o *gcs.Object) // Panic if any internal invariants have been violated. The careful user can // arrange to call this at crucial moments. CheckInvariants() }
A cache mapping from name to most recent known record for the object of that name. External synchronization must be provided.
func NewStatCache ¶
Create a new stat cache that holds the given number of entries, which must be positive.
Click to show internal directories.
Click to hide internal directories.