LocalContentClient¶
-
class
kanzi::connect
::
LocalContentClient
: public ContentClient¶ A content client variant that provides direct access to the content manager without any extra overhead.
This class can be used in Kanzi Connect server to directly operate with the Content Service. It introduces certain constraints to the usage:
Since content manager is a core service of Kanzi Connect server, this class is only useful on server-side development.
The Content Service and the user of this class (content subscriber) need to operate in the same process and thread.
The access to the Content Service is synchronous and is not protected in any way (ie. it is not thread safe). To get around these constraints, use RemoteContentClient class instead.
Unnamed Group
-
ContentToken
acquireContentToken
() override¶ - See
ContentClient
-
void
releaseContentToken
(ContentToken token) override¶ Release content token and unregister from content service.
- Parameters
token
: the content token to release.
Subscribe to a table based content.
- Return
true if subscription started, false if problems were met. Possible reasons for failure include for example trying to subscribe to same domain twice using same content token.
- Parameters
token
: Content token, identifies the user of content API, needs to be acquired first. When subscribing to table based content (content:// or service://) new token must be allocated for each content domain (E.g. com.rightware.content).args
: Query Arguments.callback
: Function callback for results.invalidationCallback
: function to invoke when content provider informs that certain part of the content has been invalidated.
Subscribe to content.
- Return
true if subscription started, false if there were no session available.
- Parameters
token
: content content, identifies the user of content API.args
: Query Arguments.
-
void
unsubscribe
(ContentToken token, const string &uri) override¶ Unsubscribe from content URI.
- Parameters
token
: Content token.uri
: Content URI to unsubscribe. Must be previously subscribed.
Adds content provider to content system.
- Return
true if succeeded, false on error.
- Parameters
token
: Content token, identifies the user of content API, needs to be acquired first.uri
: Content URI that is handled by the content provider.contentProvider
: Content provider to add.
Removes content provider from content system.
- Parameters
token
: Content token, identifies the user of content API, needs to be acquired first.contentProvider
: Content provider to remove.
-
bool
subscribeRuntimeData
(ContentToken token, const string uri, RuntimeDataResultCallbackFunction callback, int credits, int creditreturninterval) override¶ Subscribes to a service runtime data.
- Return
true if subscription started, false if there were no session available.
- Parameters
token
: Content token, identifies the user of content API.uri
: The content URI where to subscribe. Usually something like service://cluster.callback
: Function callback for results.credits
: amount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.creditreturninterval
: how often functionality will return transfer credits to the content producer. Smaller the value more housekeeping traffic is produced.
-
bool
subscribeRuntimeDataEx
(ContentToken token, const string uri, ContentClientRuntimeDataObserver *observer, int credits, int creditreturninterval) override¶ Subscribe to service runtime data.
- Return
true if subscription started, false if there were no session available or subscription for the specific uri is already available.
- Parameters
token
: Content token, identifies the user of content API, needs to be acquired first.observer
: Observer interface to be invoked when subscribed runtime data changes.credits
: amount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.creditreturninterval
: how often functionality will return transfer credits to the content producer. Smaller the value more housekeeping traffic is produced.
-
void
unsubscribeRuntimeData
(ContentToken token, const string &uri) override¶ Unsubscribe from runtime data.
- Parameters
token
: Content token to unsubscribe.uri
: Service URI where to unsubscribe from.
-
bool
hasSession
(ContentToken token) override¶ Determine whether specific content token has session currently available.
- Return
true if session exists
- Parameters
token
: content token
-
void
setVerboseLog
(bool verbose) override¶ Configures verbose logging for the content client.
- Parameters
verbose
: whether to be verbose or not.
-
bool
getVerboseLog
() const override¶ Return the current state of log verbosity.
- Return
log verbosity.
Public Functions
-
~LocalContentClient
()¶ Destructor.
Public Static Functions
Creates a new instance of LocalContentClient class.
- Return
Shared pointer to new LocalContentClient instance.
- Parameters
contentManager
: Content Manager that is used to access to content.