hashutil

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvisoryLockHash

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

AdvisoryLockHash's job is to produce a pair of keys that'll be used with Postgres advisory lock functions like `pg_advisory_xact_lock`.

Advisory locks all share a single 64-bit number space, so it's technically possible for completely unrelated locks to collide with each other. It's quite unlikely, but this type allows a user to configure a specific 32-bit prefix which they can use to guarantee that no River hash will ever conflict with one from their application. If no prefix is configured, it'll use the entire 64-bit number space.

func NewAdvisoryLockHash

func NewAdvisoryLockHash(configuredPrefix int32) *AdvisoryLockHash

func (*AdvisoryLockHash) Key

func (h *AdvisoryLockHash) Key() int64

Key generates a pair of keys to be passed into Postgres advisory lock functions like `pg_advisory_xact_lock`.

func (*AdvisoryLockHash) Write

func (h *AdvisoryLockHash) Write(data []byte)

Write writes bytes to the underlying hash.

Jump to

Keyboard shortcuts

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