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

github.com/ishan27g/vclock

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ishan27g/vclock

  • v0.0.0-20220313143106-98dea0f2d782
  • Source
  • Go
  • Socket score

Version published
Created
Source

Vector-clock based event ordering

package main

import "github.com/Ishan27gOrg/vClock"

// VectorClock : provides interface to implement vector clock
type VectorClock interface {
	// SendEvent returns the current vector clock after first updating self clock and then
	// updating the individual clocks for corresponding addresses
	SendEvent(id string, addresses []string) vClock.EventClock
	// Get returns the current vector clock
	Get(id string) vClock.EventClock
	// ReceiveEvent updates the current vector clock using element wise maximum with the passed vector clock
	ReceiveEvent(id string, v vClock.EventClock)
	Clear(id string)
	print()
}
// Events : provides interface to merge and order events based on vector clocks
type Events interface {
	// MergeEvents merges the current event clocks with received event clocks, new events are added to current list
	MergeEvents(es ...vClock.Event)
	// MergeEvent takes an eventId & clock and merges with existing clock, new events are added to current list
	MergeEvent(e vClock.Event)
	// GetCurrentEvents returns the events currently saved. Not in order
	GetCurrentEvents() []vClock.Event
	// GetEventsOrder returns the eventIds ordered according to vector clock for the events
	GetEventsOrder() (ids []string)
}

FAQs

Package last updated on 13 Mar 2022

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