{"id":18418596,"url":"https://github.com/bsm/planb","last_synced_at":"2025-10-03T23:23:15.927Z","repository":{"id":57510789,"uuid":"104225488","full_name":"bsm/planb","owner":"bsm","description":"Build distributed, low-latency services with a redis-compatible protocol and sentinel client support","archived":false,"fork":false,"pushed_at":"2018-01-24T16:33:33.000Z","size":36,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-22T19:02:29.608Z","etag":null,"topics":["cluster","distributed-database","go","golang","low-latency","raft","redeo","redis"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsm.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}},"created_at":"2017-09-20T14:22:17.000Z","updated_at":"2024-09-10T00:07:35.000Z","dependencies_parsed_at":"2022-09-26T17:50:58.635Z","dependency_job_id":null,"html_url":"https://github.com/bsm/planb","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/bsm%2Fplanb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fplanb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fplanb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fplanb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsm","download_url":"https://codeload.github.com/bsm/planb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247661664,"owners_count":20975095,"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":["cluster","distributed-database","go","golang","low-latency","raft","redeo","redis"],"created_at":"2024-11-06T04:14:05.891Z","updated_at":"2025-10-03T23:23:10.884Z","avatar_url":"https://github.com/bsm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plan B\n\n[![GoDoc](https://godoc.org/github.com/bsm/planb?status.svg)](https://godoc.org/github.com/bsm/planb)\n[![Build Status](https://travis-ci.org/bsm/planb.png?branch=master)](https://travis-ci.org/bsm/planb)\n[![Go Report Card](https://goreportcard.com/badge/github.com/bsm/planb)](https://goreportcard.com/report/github.com/bsm/planb)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nPlan B is a toolkit for building distributed, low-latency services that speak [RESP](https://redis.io/topics/protocol)\n(REdis Serialization Protocol). Under the hood, it is wrapping [Redeo](https://github.com/bsm/redeo) and\n[Raft](https://github.com/hashicorp/raft) to create a concise interface for custom commands.\n\n## Examples\n\nA simple server example:\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n\n  \"github.com/bsm/planb\"\n  \"github.com/hashicorp/raft\"\n\n)\n\nfunc main() {\n\t// Open a store\n\tstore := planb.NewInmemStore()\n\n\t// Init config\n\tconf := planb.NewConfig()\n\tconf.Sentinel.MasterName = \"mymaster\"\t// handle SENTINEL commands\n\n\t// Init server\n\tsrv, err := planb.NewServer(\"10.0.0.1:7230\", \".\", store, raft.NewInmemStore(), raft.NewInmemStore(), conf)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Setup SET handler\n\tsrv.HandleRW(\"SET\", nil, redeo.WrapperFunc(func(cmd *resp.Command) interface{} {\n\t\tif len(cmd.Args) != 2 {\n\t\t\treturn redeo.ErrWrongNumberOfArgs(cmd.Name)\n\t\t}\n\n\t\tif err := store.Put(cmd.Args[0], cmd.Args[1]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn \"OK\"\n\t}))\n\n\t// Setup GET handler\n\tsrv.HandleRO(\"GET\", nil, redeo.WrapperFunc(func(cmd *resp.Command) interface{} {\n\t\tif len(cmd.Args) != 1 {\n\t\t\treturn redeo.ErrWrongNumberOfArgs(cmd.Name)\n\t\t}\n\n\t\tval, err := store.Get(cmd.Args[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn val\n\t}))\n\n\t// Start serving\n\tif err := srv.ListenAndServe(); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Fplanb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsm%2Fplanb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Fplanb/lists"}