{"action":"closed","issue":{"url":"https://api.github.com/repos/also-engineering/Tangerine-client/issues/2","labels_url":"https://api.github.com/repos/also-engineering/Tangerine-client/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/also-engineering/Tangerine-client/issues/2/comments","events_url":"https://api.github.com/repos/also-engineering/Tangerine-client/issues/2/events","html_url":"https://github.com/also-engineering/Tangerine-client/issues/2","id":115626521,"number":2,"title":"Small ID service (server)","user":{"login":"fetmar","id":140294,"avatar_url":"https://avatars.githubusercontent.com/u/140294?v=3","gravatar_id":"","url":"https://api.github.com/users/fetmar","html_url":"https://github.com/fetmar","followers_url":"https://api.github.com/users/fetmar/followers","following_url":"https://api.github.com/users/fetmar/following{/other_user}","gists_url":"https://api.github.com/users/fetmar/gists{/gist_id}","starred_url":"https://api.github.com/users/fetmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fetmar/subscriptions","organizations_url":"https://api.github.com/users/fetmar/orgs","repos_url":"https://api.github.com/users/fetmar/repos","events_url":"https://api.github.com/users/fetmar/events{/privacy}","received_events_url":"https://api.github.com/users/fetmar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/also-engineering/Tangerine-client/labels/feature","name":"feature","color":"009800"},{"url":"https://api.github.com/repos/also-engineering/Tangerine-client/labels/loe:medium","name":"loe:medium","color":"0052cc"},{"url":"https://api.github.com/repos/also-engineering/Tangerine-client/labels/pr:high","name":"pr:high","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-07T02:35:23Z","updated_at":"2015-11-15T12:25:01Z","closed_at":"2015-11-15T12:25:01Z","body":"# Intent\r\n\r\nTo provide a thrifty conflict free id service.\r\n\r\n# Context\r\n\r\nCouchDB's IDs are large and we don't require that level of complexity.\r\n\r\nWhen you save a document and don't supply an ID yourself. It will be assigned one by CouchDB's uuid service. A shorter sequential ID scheme will yield a lot of savings in disk space and likely some performance.\r\n\r\nA similar service will be required for the client side. The only difference is that on the client side the only persistence will be PouchDB and the language will be JavaScript, it's therefore recommended that this service use Node.js/Express and that the persistence be abstracted from the sequencing logic. Some fast keystore database is probably a good bet serverside.\r\n\r\n# Specs\r\n\r\nSequences should\r\n  * start at 0\r\n  * use an 0-9, a-z, A-Z character set, or base-62. \r\n  * not use dashes, they are reserved as delimiters.\r\n  * not use underscore characters. They are left undefined.\r\n  * be expected to grow and not be 0 padded\r\n\r\nThe service \r\n  * should allow any user (security roles are to be added later) to ask for an ID for a specified type and database.\r\n  * should allow any user to ask for a client prefix.\r\n  * The service should only keep track of one sequence of IDs per database per type.\r\n  * The service should only keep track of one sequence of client prefixes per database.\r\n\r\n* Client prefixes should be be sequential and use the same character set as the IDs.\r\n\r\n* A post request to the service should return the first unused ID or client prefix\r\n  * a database name is required.\r\n  * a doc type character is required.\r\n  * a number, n, may be supplied as a parameter to the server, in that case, the internal sequence counter will increment by that number, and we will assume the client has claimed n IDs.\r\n  * In the case no number is supplied, we assume n = 1\r\n\r\n# Uses\r\n\r\nWhen a client boots for the first time they will ask the service for a client prefix. They will store that information internally and prefix their own IDs with the prefix supplied by the service.\r\n\r\nAs new documents are created on the server, the Tangerine application requests a new Id from the service. The new documents are saved with that Id.\r\n\r\n# Excluded\r\n\r\n* The actual saving of documents will be handled in the application. Most simplistically this is only a service that keeps track of counts.\r\n"}}