feisty meow concerns codebase  2.140
synchronic::list_manager Class Referenceabstract

Supports distributed management of a list of object states. More...

#include <list_manager.h>

Inheritance diagram for synchronic::list_manager:
Collaboration diagram for synchronic::list_manager:

Public Member Functions

 list_manager (const structures::string_array &list_name, bool backgrounded)
 
virtual ~list_manager ()
 
int entries () const
 
const structures::string_arraylist_name () const
 
bool is_listed (const structures::string_array &classifier)
 
bool update (const structures::string_array &classifier, int offset=0)
 
void clean (int older_than)
 
synchronizableclone_object (const structures::string_array &classifier)
 
bool zap (const structures::string_array &classifier)
 
void retrieve (bundle_list &to_fill) const
 
void reset ()
 
virtual basis::outcome consume (octopi::infoton &to_chow, const octopi::octopus_request_id &item_id, basis::byte_array &transformed)
 this is the main function that processes infotons for this tentacle. More...
 
virtual basis::outcome reconstitute (const structures::string_array &classifier, basis::byte_array &packed_form, octopi::infoton *&reformed)=0
 regenerates an infoton from its packed form. More...
 
virtual void expunge (const octopi::octopus_entity &to_remove)
 called to remove traces of the entity "to_remove". More...
 
- Public Member Functions inherited from octopi::tentacle
 tentacle (const structures::string_array &group_name, bool backgrounded, int motivational_rate=tentacle::DEFAULT_RATE)
 constructs a tentacle that handles infotons with the "group_name". More...
 
virtual ~tentacle ()
 
 DEFINE_CLASS_NAME ("tentacle")
 
const structures::string_arraygroup () const
 returns the name of the group that this tentacle services. More...
 
bool backgrounding () const
 reports on whether this tentacle supports background operation or not. More...
 
int motivational_rate () const
 returns the background processing rate this was constructed with. More...
 
basis::outcome enqueue (infoton *to_chow, const octopus_request_id &item_id)
 holds onto infotons coming from the octopus for backgrounding. More...
 
infotonnext_request (octopus_request_id &item_id)
 pops out the next queued request for processing. More...
 
bool store_product (infoton *product, const octopus_request_id &original_id)
 used by tentacles to store the objects they produce from infotons. More...
 
void attach_storage (entity_data_bin &storage)
 used when a tentacle is being integrated with an octopus. More...
 
void detach_storage ()
 unhooks the storage bin from this tentacle. More...
 
entity_data_binget_storage ()
 returns the current pointer, which might be nil. More...
 
void propel_arm ()
 invoked by our thread to cause requests to be processed. More...
 

Additional Inherited Members

- Public Types inherited from octopi::tentacle
enum  constants { DEFAULT_RATE = 40 }
 
enum  outcomes {
  OKAY = basis::common::OKAY , NOT_FOUND = basis::common::NOT_FOUND , ALREADY_EXISTS = basis::common::EXISTING , BAD_INPUT = basis::common::BAD_INPUT ,
  NO_SPACE = basis::common::NO_SPACE , GARBAGE = basis::common::GARBAGE , DISALLOWED = basis::common::DISALLOWED , NO_HANDLER = basis::common::NO_HANDLER ,
  PARTIAL = basis::common::PARTIAL , ENCRYPTION_MISMATCH = basis::common::ENCRYPTION_MISMATCH
}
 
- Static Public Member Functions inherited from octopi::tentacle
static const char * outcome_name (const basis::outcome &to_name)
 returns the textual form of the outcome "to_name". More...
 

Detailed Description

Supports distributed management of a list of object states.

An object may have a collection of attributes which are important to keep up to date. The list_manager provides a means to keep that information relevant given periodic updates to the state information by the entity in charge of the actual object.

Definition at line 34 of file list_manager.h.

Constructor & Destructor Documentation

◆ list_manager()

synchronic::list_manager::list_manager ( const structures::string_array list_name,
bool  backgrounded 
)

Definition at line 41 of file list_manager.cpp.

◆ ~list_manager()

synchronic::list_manager::~list_manager ( )
virtual

Definition at line 48 of file list_manager.cpp.

References basis::WHACK().

Member Function Documentation

◆ clean()

◆ clone_object()

synchronizable * synchronic::list_manager::clone_object ( const structures::string_array classifier)

◆ consume()

outcome synchronic::list_manager::consume ( octopi::infoton to_chow,
const octopi::octopus_request_id item_id,
basis::byte_array transformed 
)
virtual

this is the main function that processes infotons for this tentacle.

the octopus will feed this function with appropriate data "to_chow" for infotons that are to be processed by this tentacle's group(). the "item_id" provides for the requesting entity an origination marker that can be used in produce() below. the outcome indicates whether the processing was successful. processing could fail due to a missing handler for the item, due to erronous data in the infoton, because of resource limits placed on the tentacle, from explicit rejection by the tentacle, or due to other causes. the "transformed" is a packed infoton that may be generated during the consumption of "to_chow" (it must actually be a packed classifier and then the packed infoton). if it can be unpacked successfully, then it will be treated as the actual infoton that was to be consumed. this is only expected from a filter. note: the infoton "to_chow" can be destructively manipulated by the tentacle, including patching the classifier for internal octopi or rearranging any data contained in "to_chow". none of these changes will be seen by the entity that requested processing. regarding filters: if this tentacle is serving as a filter, then it may be presented with infotons that are not covered by its group. given such an infoton, the tentacle should perform whatever filtering is to be done, including modifying the infoton appropriately, and return PARTIAL when it liked the infoton or DISALLOWED when it rejects the infoton. it is understood that the infoton will be passed along to the rest of the tentacles when the successful result of PARTIAL is returned.

Implements octopi::tentacle.

Definition at line 145 of file list_manager.cpp.

References synchronic::synchronizable::_mod, synchronic::synchronizable::ADDED, octopi::tentacle::BAD_INPUT, structures::amorph< contents >::borrow(), synchronic::synchronizable::CHANGED, octopi::infoton::classifier(), synchronic::synchronizable::clone(), synchronic::synchronizable::DELETED, synchronic::synchronizable::EMPTY, FUNCDEF, GRAB_LOCK, LOG, basis::negative(), octopi::tentacle::NO_HANDLER, basis::non_negative(), octopi::tentacle::NOT_FOUND, octopi::tentacle::OKAY, basis::array< contents >::reset(), synchronic::synchronizable::text_form(), and structures::amorph< contents >::zap().

◆ entries()

int synchronic::list_manager::entries ( ) const

Definition at line 56 of file list_manager.cpp.

References structures::amorph< contents >::elements(), and GRAB_LOCK.

◆ expunge()

void synchronic::list_manager::expunge ( const octopi::octopus_entity to_remove)
virtual

called to remove traces of the entity "to_remove".

this is an order from the octopus that all traces of the entity "to_remove" should now be cleaned out. that entity has been utterly destroyed and any data structures held for it should be thrown out also. the required actions are specific to the tentacle's design.

Implements octopi::tentacle.

Definition at line 202 of file list_manager.cpp.

References FUNCDEF.

◆ is_listed()

bool synchronic::list_manager::is_listed ( const structures::string_array classifier)

Definition at line 68 of file list_manager.cpp.

References GRAB_LOCK, and basis::negative().

◆ list_name()

const string_array & synchronic::list_manager::list_name ( ) const

Definition at line 54 of file list_manager.cpp.

References octopi::tentacle::group().

Referenced by synchronic::list_synchronizer::update().

◆ reconstitute()

virtual basis::outcome synchronic::list_manager::reconstitute ( const structures::string_array classifier,
basis::byte_array packed_form,
octopi::infoton *&  reformed 
)
pure virtual

regenerates an infoton from its packed form.

given the "classifier" under which the object is categorized, this reconstructs a "reformed" infoton equivalent to the flattened infoton in "packed_form". the "packed_form" is destructively consumed. NOTE: it is crucial that the derived method calls set_classifier() on the "reformed" infoton from the passed "classifier".

Implements octopi::tentacle.

◆ reset()

void synchronic::list_manager::reset ( )

◆ retrieve()

void synchronic::list_manager::retrieve ( bundle_list to_fill) const

◆ update()

bool synchronic::list_manager::update ( const structures::string_array classifier,
int  offset = 0 
)

◆ zap()

bool synchronic::list_manager::zap ( const structures::string_array classifier)

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