{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/leshan/issues/47","repository_url":"https://api.github.com/repos/eclipse/leshan","labels_url":"https://api.github.com/repos/eclipse/leshan/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/leshan/issues/47/comments","events_url":"https://api.github.com/repos/eclipse/leshan/issues/47/events","html_url":"https://github.com/eclipse/leshan/pull/47","id":115074732,"number":47,"title":"Queue Mode: base interfaces for ongoing implementation","user":{"login":"alex-ellwein","id":8912041,"avatar_url":"https://avatars.githubusercontent.com/u/8912041?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-ellwein","html_url":"https://github.com/alex-ellwein","followers_url":"https://api.github.com/users/alex-ellwein/followers","following_url":"https://api.github.com/users/alex-ellwein/following{/other_user}","gists_url":"https://api.github.com/users/alex-ellwein/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-ellwein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-ellwein/subscriptions","organizations_url":"https://api.github.com/users/alex-ellwein/orgs","repos_url":"https://api.github.com/users/alex-ellwein/repos","events_url":"https://api.github.com/users/alex-ellwein/events{/privacy}","received_events_url":"https://api.github.com/users/alex-ellwein/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eclipse/leshan/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-11-04T15:13:07Z","updated_at":"2016-04-27T10:25:11Z","closed_at":"2016-04-26T07:12:45Z","pull_request":{"url":"https://api.github.com/repos/eclipse/leshan/pulls/47","html_url":"https://github.com/eclipse/leshan/pull/47","diff_url":"https://github.com/eclipse/leshan/pull/47.diff","patch_url":"https://github.com/eclipse/leshan/pull/47.patch"},"body":"Intro\r\n=====\r\n\r\nA \"queue mode\" is an operation mode of LWM2M protocol (since the early versions\r\nof Lightweight M2M 1.0 Specification), which describes a special operation mode\r\nof a server/client if a client is not always expected to be online.\r\n\r\nThe specification states that:\r\n\r\n* A Client has to register using specified binding mode (e.g. using \"UQ\" for\r\n  \"UDP+Queue\");\r\n* A Server has to understand this binding mode (it is *mandatory*);\r\n* A client is not expected to be always online - instead, a server must queue\r\n  the requests and only allowed to send downlink requests one by one to the client\r\n  when server received client's registration update or notification.\r\n\r\nThis particular pull request contains classes splitted in two main packages:\r\n\r\n- **org.eclipse.leshan.server.queue** - contains base interfaces to operate\r\n  with queue mode, i.e. public API for sending downlink requests and managing\r\n  the queue;\r\n- **org.eclipse.leshan.server.queue.persistence** - contains interfaces to\r\n  implement own queue persistence (we will provide only a basic in-memory\r\n  persistence).\r\n\r\norg.eclipse.leshan.server.queue - Queue Mode Public API\r\n=======================================================\r\n\r\nQueueRequestSender\r\n------------------\r\n\r\n``QueueRequestSender`` is an entry point for queue mode related sending.\r\nThis is basically an extension of ``LwM2mRequestSender``, which is capable\r\nto maintain a queue of requests for every client registered with queue\r\nbinding mode and provides a basic queue management by means of\r\n``QueueManagement`` interface.\r\n\r\nQueueManagement\r\n---------------\r\n\r\nQueue Management is a public interface for interacting with the queue. It\r\ncan be used, e.g. to show QueueRequests for a particular client, drop a\r\nsingle request or even a whole client's queue.\r\n\r\nQueueRequest\r\n------------\r\n\r\nA single element of a queue of ``QueueRequestSender`` is represented by a\r\n``QueueRequest``. Amongst the downlink request and client's endpoint, it\r\ncontains an information about request's state (``QueueRequestState``),\r\nID of the request and also an expiration date of the queue request, i.e.\r\nthe time point when the queue request should not be considered/send anymore.\r\n\r\nNote: this is the user's view on a request, for persistence's view see ``QueueRequestEntity`` below.\r\n\r\nQueueRequestState\r\n-----------------\r\n\r\nEvery ``QueueRequest`` is passed through different states during its life\r\ncycle. ``QueueRequestState`` enumeration describes following states:\r\n\r\n1. A fresh created queue request which is sent via ``QueueRequestSender`` is\r\n   put in the queue with the state ``ENQUEUED``. An enqueued request remains in\r\n   this state, waiting to be send.\r\n\r\n2. A client's registration update or notify triggers a queue request to be put\r\n   in ``PROCESSING`` state. This indicates that the queue request is currently being\r\n   sent. For every client, there can be only one request in a processing state,\r\n   because all of the requests are processed strictly sequential (per client).\r\n\r\n3. a) If a ``PROCESSING`` request is timed out while sending, it returns to the\r\n   queue with the state ``DEFERRED``. This means, that after next client's\r\n   update/notify this request will be sent as first (unless the send\r\n   expiration interval is already elapsed, in this case it will be put into ``TTL_ELAPSED``\r\n   state as described in 4)\r\n\r\n  b) If a ``PROCESSING`` request is sent, then it is put into ``EXECUTED``\r\n   state. The request will be then put into ``EXECUTED`` state.\r\n\r\n c) If a ``PROCESSING`` request has been deleted by the user while\r\n      sending, it is put into ``PROCESSING_DELETED`` state. That is,\r\n      the request will still be processed until the successful or\r\n      unsucessful result of the sending operation, but will either\r\n      be promoted to ``EXECUTED`` state and then deleted or deleted\r\n      immediately upon a timeout of the send operation.\r\n4. A ``DEFERRED`` queue request, which could not be sent within its expiration\r\n   time, will be put in ``TTL_ELAPSED`` state.\r\n5. Queue requests which are in states ``EXECUTED`` or ``TTL_ELAPSED`` may be\r\n   removed from the queue (or archived for some period of time, depending on\r\n   the queue's concrete implementation).\r\n\r\nQueueRequestDeletedException\r\n----------------------------\r\n\r\nA ``QueueRequestDeletedException`` is needed to notify the sender on an explicit\r\nremoval of a ``QueueRequest``. It is thrown in the ``ErrorCallback`` registered\r\nin the ``QueueRequestSender``.\r\n\r\norg.eclipse.leshan.server.queue.persistence - Persistence Interfaces\r\n====================================================================\r\n\r\nQueuePersistence\r\n----------------\r\n\r\n``QueuePersistence`` provides basic operations for adding, retrieving, updating\r\nand deleting ``QueueRequestEntity`` elements.\r\n\r\nQueueRequestEntity\r\n------------------\r\n\r\n``QueueRequestEntity`` represents a persistence object for ``QueueRequest``.\r\n\r\nQueueRequestEntityFactory\r\n-------------------------\r\n\r\nAn interface for a factory, able to create ``QueueRequestEntities``, based\r\non given client's endpoint, downlink request and given Time-To-Live for the\r\nrequest.\r\n\r\nExpirationChecker\r\n-----------------\r\n\r\nAn ``ExpirationChecker`` allows to check an expiration of a particular\r\nqueue request and calculates the absolute time stamp for a queue request\r\nexpiration, note that the implementation of ``ExpirationChecker`` may be\r\ndependent or specific to the ``QueuePersistence`` implementation.\r\n\r\nAlso-by: Daniel Maier <daniel.maier@bosch-si.com>\r\n\r\nSigned-off-by: Alexander Ellwein <alexander.ellwein@bosch-si.com>"},"comment":{"url":"https://api.github.com/repos/eclipse/leshan/issues/comments/215042196","html_url":"https://github.com/eclipse/leshan/pull/47#issuecomment-215042196","issue_url":"https://api.github.com/repos/eclipse/leshan/issues/47","id":215042196,"user":{"login":"balsmn","id":17613889,"avatar_url":"https://avatars.githubusercontent.com/u/17613889?v=3","gravatar_id":"","url":"https://api.github.com/users/balsmn","html_url":"https://github.com/balsmn","followers_url":"https://api.github.com/users/balsmn/followers","following_url":"https://api.github.com/users/balsmn/following{/other_user}","gists_url":"https://api.github.com/users/balsmn/gists{/gist_id}","starred_url":"https://api.github.com/users/balsmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balsmn/subscriptions","organizations_url":"https://api.github.com/users/balsmn/orgs","repos_url":"https://api.github.com/users/balsmn/repos","events_url":"https://api.github.com/users/balsmn/events{/privacy}","received_events_url":"https://api.github.com/users/balsmn/received_events","type":"User","site_admin":false},"created_at":"2016-04-27T10:25:11Z","updated_at":"2016-04-27T10:25:11Z","body":"Created a new PullRequest for this feature.\r\n\r\nhttps://github.com/eclipse/leshan/pull/126"}}