cidlocker

package module
v0.0.0-...-a55be43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2019 License: AGPL-3.0 Imports: 3 Imported by: 0

README

repo-template

GitHub repository template for Golang projects using codecov and travis CI. Includes a Makefile for common development workflow tasks, such as dependency updates, linting, formatting, etc..

Documentation

Overview

Package cidlocker is used to provide granular concurrent resource access control on a per-CID basis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIDLocker

type CIDLocker struct {
	// contains filtered or unexported fields
}

CIDLocker is used to block access to resources on a per-CID basis, useful when guarding concurrent access in systems handling many different CIDs (like reference counting)

The only time this blocks is when creating the initial lock, afterwards all writes for a record are non-blocking unless another record is first published at the same time.

func New

func New() *CIDLocker

New returns a fresh instance of CIDLocker

func (*CIDLocker) Create

func (cl *CIDLocker) Create(cid gocid.Cid)

Create is like exists, except it populates the map if the entry does not exist

func (*CIDLocker) Exists

func (cl *CIDLocker) Exists(cid gocid.Cid) bool

Exists check if we have a lock for this cid

func (*CIDLocker) Lock

func (cl *CIDLocker) Lock(cid gocid.Cid)

Lock obtains a lock for the cid

func (*CIDLocker) Unlock

func (cl *CIDLocker) Unlock(cid gocid.Cid)

Unlock reverts the cid lock

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL