-
class
StorageReflectSession
: public DumbReflectSession
(Return to index)
-
A more intelligent AbstractReflectSession that knows how tostore data on the server, and filter using wildcards. This classis used by the muscled server program to handle incoming connections.
Type:
Superclasses:
Include file:
../../reflector/StorageReflectSession.h
See StorageReflectConstants.h and/or "The Beginner's Guide.html"
for details.
Synopsis:
- Public:
- virtual status_t
AttachedToServer
()
;
-
- virtual void
MessageReceivedFromGateway
(PortableMessageRef msg)
;
-
-
StorageReflectSession
()
;
-
-
~StorageReflectSession
()
;
-
- Protected:
- typedef int
(*PathMatchCallback)
(StorageReflectSession * This, DataNode & node, void * userData)
;
-
- class
DataNode
;
-
Each object of this class represents one node in the server-side data-storage tree.
- class
DataNode
;
-
Each object of this class represents one node in the server-side data-storage tree.
- typedef PortableRef<DataNode>
DataNodeRef
;
-
- typedef PortableHashtableIterator<const char *, DataNodeRef>
DataNodeRefIterator
;
-
- int
DoSubscribeRefCallback
(DataNode & node, void * userData)
;
-
- static int
DoSubscribeRefCallbackFunc
(StorageReflectSession * This, DataNode & node, void * userData)
;
-
- int
GetDataCallback
(DataNode & node, void * userData)
;
-
- static int
GetDataCallbackFunc
(StorageReflectSession * This, DataNode & node, void * userData)
;
-
- DataNode *
GetDataNode
(const PortableString & path)
;
-
- DataNode *
GetNewDataNode
(const char * nodeName, PortableMessageRef initialValue)
;
-
- bool
GetSubscriptionsEnabled
() const
;
-
- virtual const char *
GetTypeName
() const
;
-
- int
PassMessageCallback
(DataNode & node, void * userData)
;
-
- static int
PassMessageCallbackFunc
(StorageReflectSession * This, DataNode & node, void * userData)
;
-
- void
ReleaseDataNode
(DataNode * node)
;
-
- int
RemoveDataCallback
(DataNode & node, void * userData)
;
-
- static int
RemoveDataCallbackFunc
(StorageReflectSession * This, DataNode & node, void * userData)
;
-
- status_t
SetDataNode
(const PortableString & nodePath, PortableMessageRef dataMsgRef, bool allowOverwriteData=true, bool allowCreateNode=true)
;
-
- typedef PortableRef<PortableQueue<StringMatcherRef> >
StringMatcherQueueRef
;
-
- typedef PortableRef<StringMatcher>
StringMatcherRef
;
-
- friend class StorageReflectSession ::
WildPathMatcher
;
-
This class is used to do efficient pattern-matching on wild paths (e.g. "fries*")
- WildPathMatcher
_defaultMessageRoute
;
-
- DataNode *
_globalRoot
;
-
- PortableMessage *
_nextSubscriptionMessage
;
-
- static DataNodeRef::ItemPool
_nodePool
;
-
- static DataNodeRef::RefPool
_nodeRefPool
;
-
- PortableMessage
_parameters
;
-
- DataNodeRef
_sessionDir
;
-
- static StringMatcherRef::ItemPool
_stringMatcherPool
;
-
- static StringMatcherQueueRef::ItemPool
_stringMatcherQueuePool
;
-
- static StringMatcherQueueRef::RefPool
_stringMatcherQueueRefPool
;
-
- static StringMatcherRef::RefPool
_stringMatcherRefPool
;
-
- WildPathMatcher
_subscriptions
;
-
- bool
_subscriptionsEnabled
;
-
- Friends:
- friend class StorageReflectSession ::
WildPathMatcher
;
-
This class is used to do efficient pattern-matching on wild paths (e.g. "fries*")
Public methods:
Protected methods:
- protected typedef int
(*PathMatchCallback) (StorageReflectSession * This, DataNode & node, void * userData)
This typedef represents the proper signature of a node-tree traversal callback function.
Functions with this signature may be used with the WildPathMatcher::DoTraversal() method.
(This) is the StorageReflectSession doing the traveral, as specified in the DoTraversal() call
(node) is the DataNode that was matched the criteria of the traversal
(userData) is the same value that was passed in to the DoTraversal() method.
The callback function should return the depth at which the traversal should continue after
the callback is done. So to allow the traversal to continue normally, return (node.GetDepth()),
or to terminate the traversal immediately, return 0, or to resume the search at the next
session, return 2, or etc.
- protected class
DataNode
Each object of this class represents one node in the server-side data-storage tree.
- protected class
DataNode
Each object of this class represents one node in the server-side data-storage tree.
- protected typedef PortableRef<DataNode>
DataNodeRef
- protected typedef PortableHashtableIterator<const char *, DataNodeRef>
DataNodeRefIterator
- protected int
DoSubscribeRefCallback (DataNode & node, void * userData)
Traversal callback: matching nodes are ref'd/unref'd with subscribed session IDs
- protected static int
DoSubscribeRefCallbackFunc (StorageReflectSession * This, DataNode & node, void * userData)
- protected int
GetDataCallback (DataNode & node, void * userData)
Traversal callback: matching nodes are placed into the given message (userData).
- protected static int
GetDataCallbackFunc (StorageReflectSession * This, DataNode & node, void * userData)
- protected DataNode *
GetDataNode (const PortableString & path)
Convenience method: Uses the given path to lookup a single node in the node tree
and return it. (Note that wildcards are not supported by this method!)
If (path) begins with a '/', the search will begin with the root
node of the tree; if not, it will begin with this session's node. Returns NULL on failure.
- protected DataNode *
GetNewDataNode (const char * nodeName, PortableMessageRef initialValue)
Call this to get a new DataNode, instead of using the DataNode ctor directly
- protected bool
GetSubscriptionsEnabled () const
- protected virtual const char *
GetTypeName () const
- protected int
PassMessageCallback (DataNode & node, void * userData)
Traversal callback: matching nodes are sent the given message (userData).
- protected static int
PassMessageCallbackFunc (StorageReflectSession * This, DataNode & node, void * userData)
- protected void
ReleaseDataNode (DataNode * node)
Call this when you are done with a DataNode, instead of the DataNode destructor
- protected int
RemoveDataCallback (DataNode & node, void * userData)
Traversal callback: matching nodes are placed in a list (userData) to be
removed from the node tree.
- protected static int
RemoveDataCallbackFunc (StorageReflectSession * This, DataNode & node, void * userData)
- protected status_t
SetDataNode (const PortableString & nodePath, PortableMessageRef dataMsgRef, bool allowOverwriteData=true, bool allowCreateNode=true)
Create or Set the value of a data node.
(nodePath) should be the path relative to the home dir (e.g. "MyNode/Child1/Grandchild2")
(dataMsgRef) is the value to set the node to
(allowOverwriteData) indicates whether existing node-data may be overwritten. If false, the method will fail if the specified node already exists.
(allowCreateNode) indicates whether new nodes may be created. (If false,
the method will fail if any node in the specified node path
doesn't already exist)
Returns B_NO_ERROR on success, or B_ERROR on failure.
- protected typedef PortableRef<PortableQueue<StringMatcherRef> >
StringMatcherQueueRef
- protected typedef PortableRef<StringMatcher>
StringMatcherRef
- protected friend class StorageReflectSession ::
WildPathMatcher
This class is used to do efficient pattern-matching on wild paths (e.g. "fries*")
- protected WildPathMatcher
_defaultMessageRoute
- protected DataNode *
_globalRoot
Points to shared root for all sessions
- protected PortableMessage *
_nextSubscriptionMessage
will be sent when a subscription triggers
- protected static DataNodeRef::ItemPool
_nodePool
Below: item pools to reduce memory allocations/deallocations
- protected static DataNodeRef::RefPool
_nodeRefPool
- protected PortableMessage
_parameters
- protected DataNodeRef
_sessionDir
this session's subdir (grandchild of _globalRoot)
- protected static StringMatcherRef::ItemPool
_stringMatcherPool
- protected static StringMatcherQueueRef::ItemPool
_stringMatcherQueuePool
- protected static StringMatcherQueueRef::RefPool
_stringMatcherQueueRefPool
- protected static StringMatcherRef::RefPool
_stringMatcherRefPool
- protected WildPathMatcher
_subscriptions
- protected bool
_subscriptionsEnabled
Friend methods: