{"action":"created","issue":{"url":"https://api.github.com/repos/universal-ctags/ctags/issues/423","labels_url":"https://api.github.com/repos/universal-ctags/ctags/issues/423/labels{/name}","comments_url":"https://api.github.com/repos/universal-ctags/ctags/issues/423/comments","events_url":"https://api.github.com/repos/universal-ctags/ctags/issues/423/events","html_url":"https://github.com/universal-ctags/ctags/issues/423","id":93136289,"number":423,"title":"RFC: Daemon mode","user":{"login":"vhda","id":606876,"avatar_url":"https://avatars.githubusercontent.com/u/606876?v=3","gravatar_id":"","url":"https://api.github.com/users/vhda","html_url":"https://github.com/vhda","followers_url":"https://api.github.com/users/vhda/followers","following_url":"https://api.github.com/users/vhda/following{/other_user}","gists_url":"https://api.github.com/users/vhda/gists{/gist_id}","starred_url":"https://api.github.com/users/vhda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vhda/subscriptions","organizations_url":"https://api.github.com/users/vhda/orgs","repos_url":"https://api.github.com/users/vhda/repos","events_url":"https://api.github.com/users/vhda/events{/privacy}","received_events_url":"https://api.github.com/users/vhda/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/universal-ctags/ctags/labels/General%20discussion","name":"General discussion","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-05T19:02:03Z","updated_at":"2015-07-07T10:28:34Z","closed_at":null,"body":"I've been toying around with this idea in my head, where one could run ctags in a daemon mode. This could prove to be useful specially in development environments, where the file currently under update is constantly changing, but we don't really want to run ctags in the complete repository. In a daemon mode, ctags could quickly replace the tag list in memory of that file with a new one.\r\n\r\nI see two different complexity levels for this feature, being possible to develop the second on the top of the first:\r\n\r\n1. Simple Unix (or similar) socket that receives a file name and ctags will parse that file, update the tag list in memory and write a new tags file.\r\n2. Use dbus instead of the socket and adding the capability to also query the current tag database.\r\n\r\nAt this point I just to have your opinions about this idea, as I don't even know if I would have the capability of implementing such a feature!\r\n"},"comment":{"url":"https://api.github.com/repos/universal-ctags/ctags/issues/comments/119163182","html_url":"https://github.com/universal-ctags/ctags/issues/423#issuecomment-119163182","issue_url":"https://api.github.com/repos/universal-ctags/ctags/issues/423","id":119163182,"user":{"login":"masatake","id":77077,"avatar_url":"https://avatars.githubusercontent.com/u/77077?v=3","gravatar_id":"","url":"https://api.github.com/users/masatake","html_url":"https://github.com/masatake","followers_url":"https://api.github.com/users/masatake/followers","following_url":"https://api.github.com/users/masatake/following{/other_user}","gists_url":"https://api.github.com/users/masatake/gists{/gist_id}","starred_url":"https://api.github.com/users/masatake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masatake/subscriptions","organizations_url":"https://api.github.com/users/masatake/orgs","repos_url":"https://api.github.com/users/masatake/repos","events_url":"https://api.github.com/users/masatake/events{/privacy}","received_events_url":"https://api.github.com/users/masatake/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T10:28:34Z","updated_at":"2015-07-07T10:28:34Z","body":"@vhda, My understanding that you are talking about in-memory data base(let's call it mdb here).\r\nThere is no mdb in current ctags. \r\n\r\n\r\nIt is not possible to implement based on cork.\r\nPlease, look at https://github.com/universal-ctags/ctags/blob/master/docs/output-tag-stream.svg\r\nThis figure shows output related code of current ctags.\r\nIn the output of parser is corked, an entry passed to makeTagEntry goes a cork queue via queueTagEntry function. When uncorked, the entries in the cork queue are flushed to a file.\r\n\r\nThe cork queue is part of TagFile global variable. If ctags can have a cork queue per input files,\r\nyou can get what you want now. \r\n\r\nS1.  When ctags starting as a daemon, ctags parses files and store the result to queues. Each queues are associated with each input files.\r\nS2. When ctags get a query from a client, ctags scans the queues for getting an answer.\r\nS3. When ctags detects the update of an input file, ctags clears the queue associated with the input file, parse the input file again and store the tags to the queue.\r\n\r\ncork API is introduced for making scope information easier. So its public API is limited.\r\nHowever, you can extend it for your trial.\r\n\r\nFor the purpose of S2(querying), cork queues may be slow. It takes O(n * m) here n is number of tags in an input file and m is the number of input files.\r\n\r\n\r\nCompletely different approach is using sqlite. Look at the figure again. There 3 backends(writeEtagsEntry, writeXrefEntry, and writeCtagsEntry) for writeTagEntry. You can add one more, writeSqliteEntry. "}}