{"id":17528544,"url":"https://github.com/vancluever/fspubsub","last_synced_at":"2025-03-06T08:32:02.836Z","repository":{"id":73276477,"uuid":"93335453","full_name":"vancluever/fspubsub","owner":"vancluever","description":"A simple file-system based streaming event store","archived":true,"fork":false,"pushed_at":"2018-11-08T19:41:54.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T11:15:03.296Z","etag":null,"topics":["event-sourcing","go","golang","messaging","pubsub"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vancluever.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-04T19:07:43.000Z","updated_at":"2024-07-25T01:29:14.000Z","dependencies_parsed_at":"2023-04-06T23:53:39.205Z","dependency_job_id":null,"html_url":"https://github.com/vancluever/fspubsub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Ffspubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Ffspubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Ffspubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Ffspubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vancluever","download_url":"https://codeload.github.com/vancluever/fspubsub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242176480,"owners_count":20084582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["event-sourcing","go","golang","messaging","pubsub"],"created_at":"2024-10-20T15:44:03.175Z","updated_at":"2025-03-06T08:32:02.826Z","avatar_url":"https://github.com/vancluever.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/vancluever/fspubsub?status.svg)](https://godoc.org/github.com/vancluever/fspubsub)\n\n# fspubsub\n\n`fspubsub` is a very simple streaming event store, good to demonstrate the\nbasics of event publishing and subscription. It publishes events directly to the\nfilesystem, with the subscriber listening to the publishing location with\ninotify. It also has facilities to pull the entire current store, and a single\nevent.\n\nNote that the hook on inotify events currently means that this package is\nsupported on Linux only.\n\n## Usage Synopsis\n\nStreams are named for the type of event they support. An event is a type,\nalthough realistically, it is probably a struct:\n\n```\ntype TestEvent struct {\n  Text string\n}\n```\n\nUsing the above type, you can start a stream by creating a publisher for the\nevent you will be publishing to:\n\n```\np, err := pub.NewPublisher(\"./\", TestEvent{})\nif err != nil {\n  return log.Fatalf(\"[FATAL] Could not create stream: %s\", err)\n}\n```\n\nNote that the struct that you pass to the event in `NewPublisher` does not need\nto have data in it, and in fact is ignored if there is any.\n\nAfter the publisher is created, sending the event is as easy as sending the\nstruct along:\n\n```\ne := \u0026TestEvent{Text: \"Foo\"}\nid, err := p.Publish(e)\nif err != nil {\n  return log.Fatalf(\"[FATAL] Could not publish event: %s\", err)\n}\n```\n\nTo listen for events on the stream, create a new subscriber via `NewSubscriber`.\nYou can then use `Queue` to get a channel where you can watch for events, and\n`Done` to get a channel that will close when the stream is done or fails for\nsome other reason. The error will be in `Error` when done, if any.\n\n```\ns, err := sub.NewSubscriber(wd, TestEvent{})\nif err != nil {\n  log.Fatalf(\"[FATAL] Cannot create subscriber: %s\", err)\n}\ngo func() {\n  for {\n    select {\n    case event := \u003c-s.Queue():\n      // Do something with event here\n    case \u003c-s.Done():\n      return\n    }\n  }\n}()\n\u003c-s.Done()\nif s.Error() != nil {\n  log.Fatalf(\"[FATAL] Error while listening to events: %s\", s.Error())\n}\n```\n\nFor full details, see the [GoDoc](https://godoc.org/github.com/vancluever/fspubsub).\n\n## License\n\n```\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to \u003chttp://unlicense.org/\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvancluever%2Ffspubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvancluever%2Ffspubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvancluever%2Ffspubsub/lists"}