{"id":27696683,"url":"https://github.com/aprimadi/vector-clock","last_synced_at":"2025-04-25T15:12:24.739Z","repository":{"id":57538067,"uuid":"286653204","full_name":"aprimadi/vector-clock","owner":"aprimadi","description":"Vector Clock implementation in Go","archived":false,"fork":false,"pushed_at":"2020-08-11T05:30:26.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T23:15:25.424Z","etag":null,"topics":["distributed-systems","go","golang","vector-clock"],"latest_commit_sha":null,"homepage":"","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/aprimadi.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":"2020-08-11T05:24:05.000Z","updated_at":"2022-11-28T16:40:16.000Z","dependencies_parsed_at":"2022-09-07T17:24:19.646Z","dependency_job_id":null,"html_url":"https://github.com/aprimadi/vector-clock","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/aprimadi%2Fvector-clock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aprimadi%2Fvector-clock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aprimadi%2Fvector-clock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aprimadi%2Fvector-clock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aprimadi","download_url":"https://codeload.github.com/aprimadi/vector-clock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250840587,"owners_count":21495910,"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":["distributed-systems","go","golang","vector-clock"],"created_at":"2025-04-25T15:12:23.915Z","updated_at":"2025-04-25T15:12:24.727Z","avatar_url":"https://github.com/aprimadi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Vector Clock\n============\n\nVector clock is a building block for allowing multiple versions of data in a\ndistributed systems. It's being used on a distributed key value store such as\n[Dynamo](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf).\nThis library is an implementation of a vector clock in Golang.\n\n## Installation\n\n```\ngo get -u github.com/aprimadi/vector-clock\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n  \"github.com/aprimadi/vector-clock\"\n)\n\nfunc main() {\n  // Initialize empty vector clock\n  v1 := vclock.VClock{}\n\n  // Increment vector clock for a given process id\n  v1.Tick(\"pid1\")     // v1 = VClock{\"pid1\": 1}\n\n  // Create a copy of v1 and advance clock for pid2\n  v2 := v1.Copy()\n  v2.Tick(\"pid2\")     // v2 = VClock{\"pid1\": 1, \"pid2\": 1}\n\n  // Create a copy of v1 and advance clock for pid3\n  v3 := v1.Copy()\n  v3.Tick(\"pid3\")     // v3 = VClock{\"pid1\": 1, \"pid3\": 1}\n\n  // Use relation to find out the relation of two vector clocks\n  v2.Relation(v3)     // Conflict\n  v2.Relation(v1)     // Descendant\n\n  // Merge two vector clocks\n  v2.Merge(v3)        // VClock{\"pid1\": 1, \"pid2\": 1, \"pid3\": 1}\n}\n```\n\n## Serializing/deserializing\n\nSince VClock uses map[string]uint64 as its underlying implementation, it can be\nserialized directly over the network using any serialization protocol you\nchoose such as JSON, msgpack, etc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faprimadi%2Fvector-clock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faprimadi%2Fvector-clock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faprimadi%2Fvector-clock/lists"}