{"id":19611636,"url":"https://github.com/lodastack/store","last_synced_at":"2025-04-27T22:33:37.489Z","repository":{"id":57480421,"uuid":"106383173","full_name":"lodastack/store","owner":"lodastack","description":null,"archived":false,"fork":false,"pushed_at":"2020-02-12T03:11:26.000Z","size":54,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T04:23:47.276Z","etag":null,"topics":["database","db","distributed-systems","go","kv","raft","store"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lodastack.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-10-10T07:27:48.000Z","updated_at":"2024-06-20T13:01:33.000Z","dependencies_parsed_at":"2022-09-18T05:47:54.270Z","dependency_job_id":null,"html_url":"https://github.com/lodastack/store","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/lodastack%2Fstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodastack%2Fstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodastack%2Fstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodastack%2Fstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lodastack","download_url":"https://codeload.github.com/lodastack/store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251219600,"owners_count":21554444,"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":["database","db","distributed-systems","go","kv","raft","store"],"created_at":"2024-11-11T10:42:07.978Z","updated_at":"2025-04-27T22:33:32.473Z","avatar_url":"https://github.com/lodastack.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# store\n\nstore is a distributed reliable key-value store for the most critical data of a distributed system. This library is written in Go and uses the Raft consensus algorithm to manage a highly-available replicated log.\n\n## Getting started\n\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/lodastack/store/cluster\"\n)\n\nfunc main() {\n\topts := cluster.Options{\n\t\t// store bind TCP listen\n\t\tBind: \"127.0.0.1:9000\",\n\t\t// store data dir\n\t\tDataDir: \"/tmp/store\",\n\t}\n\n\tcs, err := cluster.NewService(opts)\n\tif err != nil {\n\t\tfmt.Printf(\"new store service failed: %s\", err)\n\t\treturn\n\t}\n\n\tif err := cs.Open(); err != nil {\n\t\tfmt.Printf(\"failed to open cluster service failed: %s\", err)\n\t\treturn\n\t}\n\n\t// If join was specified, make the join request.\n\tnodes, err := cs.Nodes()\n\tif err != nil {\n\t\tfmt.Printf(\"get nodes failed: %s\", err)\n\t\treturn\n\t}\n\t\n\tfmt.Println(nodes)\n}\n\n```\n\n## API\n\n```\n\t// Join joins the node, reachable at addr, to the cluster.\n\tJoin(addr string) error\n\n\t// Remove removes a node from the store, specified by addr.\n\tRemove(addr string) error\n\n\t// Create a bucket, via distributed consensus.\n\tCreateBucket(name []byte) error\n\n\t// Create a bucket via distributed consensus if not exist.\n\tCreateBucketIfNotExist(name []byte) error\n\n\t// Remove a bucket, via distributed consensus.\n\tRemoveBucket(name []byte) error\n\n\t// Get returns the value for the given key.\n\tView(bucket, key []byte) ([]byte, error)\n\n\t// ViewPrefix returns the value for the keys has the keyPrefix.\n\tViewPrefix(bucket, keyPrefix []byte) (map[string][]byte, error)\n\n\t// Set sets the value for the given key, via distributed consensus.\n\tUpdate(bucket []byte, key []byte, value []byte) error\n\n\t// RemoveKey removes the key from the bucket.\n\tRemoveKey(bucket, key []byte) error\n\n\t// Batch update values for given keys in given buckets, via distributed consensus.\n\tBatch(rows []model.Row) error\n\n\t// GetSession returns the sression value for the given key.\n\tGetSession(key interface{}) interface{}\n\n\t// SetSession sets the value for the given key, via distributed consensus.\n\tSetSession(key, value interface{}) error\n\n\t// DelSession delete the value for the given key, via distributed consensus.\n\tDelSession(key interface{}) error\n\n\t// Backup database.\n\tBackup() ([]byte, error)\n\n\t// Restore restores backup data file.\n\tRestore(backupfile string) error\n\n\t// Peers return the map of Raft addresses to API addresses.\n\tPeers() (map[string]string, error)\n\n\t// Nodes returns the list of current peers.\n\tNodes() ([]string, error)\n\n\t// WaitForLeader blocks until a leader is detected, or the timeout expires.\n\tWaitForLeader(timeout time.Duration) (string, error)\n\n\t// Close closes the store. If wait is true, waits for a graceful shutdown.\n\tClose(wait bool) error\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flodastack%2Fstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flodastack%2Fstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flodastack%2Fstore/lists"}