Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/suraj-25/vector-clock

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/suraj-25/vector-clock

  • v0.0.0-20210302161001-2cda8dc7ec7b
  • Source
  • Go
  • Socket score

Version published
Created
Source

Vector-Clock

Implementation of Vector Clock in distributed system using Golang

Vector Clock is an algorithm which generally creates the partial ordering of the events and used to detects the causality violations in a distributed system. These clocks generally expand on Scalar time to facilitate a casually consistent view of the distributed system. They detect whether a contributed event has caused another event in the distributed system. It essentially captures all the casual relationships of that system. This algorithm helps us to mark every process with a vector for each local clock of every process within the system.

Here we are implementing the Lamport Logical Clock Synchronization (Vector Clock) which shows us the timestamp for every process which took place in the system. The complete step for implementation of vector clock is given below: -

  1. First of all, we need to create a VectorC.go file. To create the VectorC.go file we first define the Timestamp type and four processes in it.

We also defined the increment or changes in the timestamp as the message sends and received by the different processes.

We defined the sleep time after which each process will respond with their respective timestamps.

We also defined several go routines which will run simultaneously for sending and receiving the message for the occurrence of the event.

The VectorClock.txt file is there from which the program will read and gives the value of the timestamps.

  1. After saving this code in file VectorC.go file, place the VectorClock.txt file in the same folder and then run the code using the command go run VectorC.go

FAQs

Package last updated on 02 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc