concrete.util.access module

class concrete.util.access.CommunicationContainerFetchHandler(communication_container)

Bases: object

FetchCommunicationService implementation using Communication containers

Implements the FetchCommunicationService interface, retrieving Communications from a dict-like communication_container object that maps Communication ID strings to Communications. The communication_container could be an actual dict, or a container such as:

Usage:

from concrete.util.access_wrapper import FetchCommunicationServiceWrapper

handler = CommunicationContainerFetchHandler(comm_container)
fetch_service = FetchCommunicationServiceWrapper(handler)
fetch_service.serve(host, port)
Parameters:communication_container – Dict-like object that maps Communication IDs to Communications
about()
alive()
fetch(fetch_request)
getCommunicationCount()
getCommunicationIDs(offset, count)
class concrete.util.access.DirectoryBackedStoreHandler(store_path)

Bases: object

Simple StoreCommunicationService implementation using a directory

Implements the StoreCommunicationService interface, storing Communications in a directory.

Parameters:store_path – Path where Communications should be Stored
about()
alive()
store(communication)

Save Communication to a directory

Stored Communication files will be named [COMMUNICATION_ID].comm. If a file with that name already exists, it will be overwritten.

class concrete.util.access.RelayFetchHandler(host, port)

Bases: object

Implements a ‘relay’ to another FetchCommunicationService server.

A FetchCommunicationService that acts as a relay to a second FetchCommunicationService, where the second service is using the TSocket transport and TCompactProtocol protocol.

This class was designed for the use case where you have Thrift JavaScript code that needs to communicate with a FetchCommunicationService server, but the server does not support the same Thrift serialization protocol as the JavaScript client.

The de-facto standard for Concrete services is to use the TCompactProtocol serialization protocol over a TSocket connection. But as of Thrift 0.10.0, the Thrift JavaScript libraries only support using TJSONProtocol over HTTP.

The RelayFetchHandler class is intended to be used as server-side code by a web application. The JavaScript code will make FetchCommunicationService RPC calls to the web server using HTTP/TJSONProtocol, and the web application will then pass these RPC calls to another FetchCommunicationService using TSocket/TCompactProtocol RPC calls.

Parameters:
about()
alive()
fetch(request)
getCommunicationCount()
getCommunicationIDs(offset, count)