dbkit

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicWriteFile

func AtomicWriteFile(path string, r io.Reader, mode os.FileMode) error

AtomicWriteFile reads from r and writes to the file named by path. To ensure atomicity the contents are written to a temporary file that is linked to the location after being successfully written.

Types

type Semaphore

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

Semaphore manages access to a resource using a set of tokens.

func NewSemaphore

func NewSemaphore(capacity int) *Semaphore

NewSemaphore will create and return a new semaphore.

func (*Semaphore) Acquire

func (s *Semaphore) Acquire(cancel <-chan struct{}, timeout time.Duration) bool

Acquire will acquire a token from the semaphore. If the function returns true the token must be released back to the semaphore exactly once.

func (*Semaphore) Release

func (s *Semaphore) Release()

Release will release a token to the semaphore. It is critical that this is only done once per token.

Jump to

Keyboard shortcuts

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