#include <Transients.h>

Inheritance diagram for Transients:
Collaboration diagram for Transients:

Classes

class  EntryStatus
 shared entry metadata, used for synchronization More...
 

Public Member Functions

 Transients ()
 
virtual ~Transients ()
 
StoreEntryfindCollapsed (const sfileno xitIndex)
 return a local, previously collapsed entry More...
 
void clearCollapsingRequirement (const StoreEntry &e)
 removes collapsing requirement (for future hits) More...
 
void monitorIo (StoreEntry *, const cache_key *, const Store::IoStatus)
 
void completeWriting (const StoreEntry &e)
 called when the in-transit entry has been successfully cached More...
 
void status (const StoreEntry &e, EntryStatus &entryStatus) const
 copies current shared entry metadata into entryStatus More...
 
int readers (const StoreEntry &e) const
 number of entry readers some time ago More...
 
void disconnect (StoreEntry &)
 the caller is done writing or reading the given entry More...
 
virtual StoreEntryget (const cache_key *) override
 
virtual void create () override
 create system resources needed for this store to operate in the future More...
 
virtual void init () override
 
virtual uint64_t maxSize () const override
 
virtual uint64_t minSize () const override
 the minimum size the store will shrink to via normal housekeeping More...
 
virtual uint64_t currentSize () const override
 current size More...
 
virtual uint64_t currentCount () const override
 the total number of objects stored right now More...
 
virtual int64_t maxObjectSize () const override
 the maximum size of a storable object; -1 if unlimited More...
 
virtual void getStats (StoreInfoStats &stats) const override
 collect statistics More...
 
virtual void stat (StoreEntry &e) const override
 
virtual void reference (StoreEntry &e) override
 somebody needs this entry (many cache replacement policies need to know) More...
 
virtual bool dereference (StoreEntry &e) override
 
virtual void evictCached (StoreEntry &) override
 
virtual void evictIfFound (const cache_key *) override
 
virtual void maintain () override
 perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain More...
 
bool markedForDeletion (const cache_key *) const
 
bool isReader (const StoreEntry &) const
 whether the entry is in "reading from Transients" I/O state More...
 
bool isWriter (const StoreEntry &) const
 whether the entry is in "writing to Transients" I/O state More...
 
virtual void updateHeaders (StoreEntry *)
 make stored metadata and HTTP headers the same as in the given entry More...
 
virtual bool anchorToCache (StoreEntry &, bool &)
 
virtual bool updateAnchored (StoreEntry &)
 
virtual int callback ()
 called once every main loop iteration; TODO: Move to UFS code. More...
 
virtual void sync ()
 prepare for shutdown More...
 

Static Public Member Functions

static int64_t EntryLimit ()
 calculates maximum number of entries we need to store and map More...
 
static bool Enabled ()
 Can we create and initialize Transients? More...
 

Protected Member Functions

void addEntry (StoreEntry *, const cache_key *, const Store::IoStatus)
 creates a new Transients entry More...
 
virtual void noteFreeMapSlice (const Ipc::StoreMapSliceId sliceId) override
 adjust slice-linked state before a locked Readable slice is erased More...
 

Private Types

typedef std::vector< StoreEntry * > Locals
 

Private Attributes

TransientsMapmap
 shared packed info indexed by Store keys, for creating new StoreEntries More...
 
Localslocals
 

Detailed Description

Keeps track of store entries being delivered to clients that arrived before those entries were [fully] cached. This SMP-shared table is necessary to

  • sync an entry-writing worker with entry-reading worker(s); and
  • sync an entry-deleting worker with both entry-reading/writing workers.

Definition at line 26 of file Transients.h.

Member Typedef Documentation

Definition at line 104 of file Transients.h.

Constructor & Destructor Documentation

Transients::Transients ( )

Definition at line 30 of file Transients.cc.

Transients::~Transients ( )
virtual

Definition at line 34 of file Transients.cc.

References locals, and map.

Member Function Documentation

virtual bool Store::Controlled::anchorToCache ( StoreEntry ,
bool &   
)
inlinevirtualinherited

If Transients entry cannot be attached to this storage, return false. If the entry is not found, return false. Otherwise, return true after tying the entry to this cache and setting inSync to updateAnchored().

Reimplemented in Rock::SwapDir, MemStore, and Store::Disks.

Definition at line 40 of file Controlled.h.

Referenced by Store::Disks::anchorToCache().

virtual int Store::Storage::callback ( )
inlinevirtualinherited

Reimplemented in Fs::Ufs::UFSSwapDir, TestStore, Store::Disks, and Store::Controller.

Definition at line 72 of file Storage.h.

virtual void Transients::create ( )
inlineoverridevirtual

Implements Store::Storage.

Definition at line 65 of file Transients.h.

uint64_t Transients::currentCount ( ) const
overridevirtual

Implements Store::Storage.

Definition at line 117 of file Transients.cc.

References Ipc::StoreMap::entryCount(), and map.

Referenced by getStats(), and stat().

uint64_t Transients::currentSize ( ) const
overridevirtual

Implements Store::Storage.

Definition at line 109 of file Transients.cc.

Referenced by stat().

bool Transients::dereference ( StoreEntry e)
overridevirtual

somebody no longer needs this entry (usually after calling reference()) return false iff the idle entry should be destroyed

Implements Store::Controlled.

Definition at line 136 of file Transients.cc.

static bool Transients::Enabled ( )
inlinestatic

Definition at line 92 of file Transients.h.

References EntryLimit().

Referenced by Store::Controller::init(), and init().

int64_t Transients::EntryLimit ( )
static
void Transients::evictCached ( StoreEntry e)
overridevirtual

Prevent new get() calls from returning the matching entry. If the matching entry is unused, it may be removed from the store now. The store entry is matched using either e attachment info or e.key.

Implements Store::Storage.

Definition at line 293 of file Transients.cc.

References CollapsedForwarding::Broadcast(), debugs, Ipc::StoreMap::freeEntry(), StoreEntry::hasTransients(), MemObject::XitTable::index, map, StoreEntry::mem_obj, and MemObject::xitTable.

void Transients::evictIfFound ( const cache_key )
overridevirtual

An evictCached() equivalent for callers that did not get() a StoreEntry. Callers with StoreEntry objects must use evictCached() instead.

Implements Store::Storage.

Definition at line 307 of file Transients.cc.

References CollapsedForwarding::Broadcast(), Ipc::StoreMap::fileNoByKey(), Ipc::StoreMap::freeEntry(), and map.

StoreEntry * Transients::findCollapsed ( const sfileno  xitIndex)

Definition at line 176 of file Transients.cc.

References assert, debugs, locals, map, MapLabel, and NULL.

StoreEntry * Transients::get ( const cache_key )
overridevirtual
Returns
a possibly unlocked/unregistered stored entry with key (or nil) The returned entry might not match the caller's Store ID or method. The caller must abandon()/release() the entry or register it with Root(). This method must not trigger slow I/O operations (e.g., disk swap in).

Implements Store::Controlled.

Definition at line 143 of file Transients.cc.

References assert, Ipc::StoreMapAnchor::basics, Ipc::StoreMap::closeForReading(), StoreEntry::createMemObject(), debugs, EBIT_TEST, ENTRY_REQUIRES_COLLAPSING, Ipc::StoreMapAnchor::exportInto(), Ipc::StoreMapAnchor::Basics::flags, MemObject::XitTable::index, MemObject::XitTable::io, Store::ioReading, KEY_PRIVATE, locals, map, StoreEntry::mem_obj, NULL, Ipc::StoreMap::openForReading(), StoreEntry::setCollapsingRequirement(), and MemObject::xitTable.

void Transients::init ( )
overridevirtual

Start preparing the store for use. To check readiness, callers should use readable() and writable() methods.

Implements Store::Storage.

Definition at line 41 of file Transients.cc.

References assert, Ipc::StoreMap::cleaner, Enabled(), EntryLimit(), locals, map, MapLabel, and Must.

Referenced by Store::Controller::init().

bool Transients::isReader ( const StoreEntry e) const

Definition at line 352 of file Transients.cc.

References MemObject::XitTable::io, Store::ioReading, StoreEntry::mem_obj, and MemObject::xitTable.

Referenced by disconnect().

bool Transients::isWriter ( const StoreEntry e) const
void Transients::maintain ( )
overridevirtual

Implements Store::Storage.

Definition at line 90 of file Transients.cc.

bool Transients::markedForDeletion ( const cache_key key) const

Whether an entry with the given public key exists and (but) was marked for removal some time ago; get(key) returns nil in such cases.

Definition at line 345 of file Transients.cc.

References assert, map, and Ipc::StoreMap::markedForDeletion().

int64_t Transients::maxObjectSize ( ) const
overridevirtual

Implements Store::Storage.

Definition at line 123 of file Transients.cc.

References max().

uint64_t Transients::maxSize ( ) const
overridevirtual

The maximum size the store will support in normal use. Inaccuracy is permitted, but may throw estimates for memory etc out of whack.

Implements Store::Storage.

Definition at line 102 of file Transients.cc.

References max().

Referenced by stat().

uint64_t Transients::minSize ( ) const
overridevirtual

Implements Store::Storage.

Definition at line 96 of file Transients.cc.

void Transients::monitorIo ( StoreEntry e,
const cache_key key,
const Store::IoStatus  direction 
)

start listening for remote DELETE requests targeting either a complete StoreEntry (ioReading) or a being-formed miss StoreEntry (ioWriting)

Definition at line 206 of file Transients.cc.

References addEntry(), assert, StoreEntry::hasTransients(), MemObject::XitTable::index, locals, StoreEntry::mem_obj, and MemObject::xitTable.

void Transients::noteFreeMapSlice ( const Ipc::StoreMapSliceId  sliceId)
overrideprotectedvirtual

Implements Ipc::StoreMapCleaner.

Definition at line 255 of file Transients.cc.

void Transients::reference ( StoreEntry e)
overridevirtual

Implements Store::Controlled.

Definition at line 130 of file Transients.cc.

void Transients::stat ( StoreEntry e) const
overridevirtual

Output stats to the provided store entry.

Todo:
make these calls asynchronous

Implements Store::Storage.

Definition at line 70 of file Transients.cc.

References currentCount(), currentSize(), Math::doublePercent(), Ipc::StoreMap::entryLimit(), map, maxSize(), PRId64, and storeAppendPrintf().

virtual void Store::Storage::sync ( void  )
inlinevirtualinherited

Reimplemented in Fs::Ufs::UFSSwapDir, Store::Controller, and Store::Disks.

Definition at line 78 of file Storage.h.

virtual bool Store::Controlled::updateAnchored ( StoreEntry )
inlinevirtualinherited

Update a local Transients entry with fresh info from this cache (if any). Return true iff the cache supports Transients entries and the given local Transients entry is now in sync with this storage.

Reimplemented in Rock::SwapDir, MemStore, and Store::Disks.

Definition at line 45 of file Controlled.h.

virtual void Store::Controlled::updateHeaders ( StoreEntry )
inlinevirtualinherited

Reimplemented in Rock::SwapDir, MemStore, and Store::Disks.

Definition at line 35 of file Controlled.h.

Referenced by Store::Disks::updateHeaders().

Member Data Documentation

Locals* Transients::locals
private

local collapsed reader and writer entries, indexed by transient ID, for syncing old StoreEntries

Definition at line 107 of file Transients.h.

Referenced by disconnect(), findCollapsed(), get(), init(), monitorIo(), and ~Transients().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors