fleetlock

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidGroup = regexp.MustCompile(`^[a-zA-Z0-9.-]+$`)

https://coreos.github.io/zincati/development/fleetlock/protocol/#body Client group is a mandatory textual label, conforming to the regexp ^[a-zA-Z0-9.-]+$

Functions

This section is empty.

Types

type ClientParams added in v0.0.2

type ClientParams struct {
	ID    string `json:"id"`
	Group string `json:"group"`
}

https://coreos.github.io/zincati/development/fleetlock/protocol/#body

type CommonGroupSettings added in v0.0.2

type CommonGroupSettings struct {
	TotalSlots int      `json:"total_slots" example:"1"`
	StaleAge   Duration `json:"stale_age" swaggertype:"string" example:"1h"`
}

Settings that look the same before and after hashing

type Duration

type Duration struct {
	time.Duration
}

Create a custom time.Duration wrapping struct so we can get a more easily readable JSON field for the data. Standard time.Duration: "stale_age": 10000000000 With this Duration: "stale_age": "10s"

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

Implement json.Marshaler interface

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

Implement json.Unmarshaler interface

type FleetLockBody

type FleetLockBody struct {
	ClientParams ClientParams `json:"client_params"`
}

The HTTP body format expected for FleetLock requests https://coreos.github.io/zincati/development/fleetlock/protocol/#body

type FleetLockConfig added in v0.0.2

type FleetLockConfig map[string]GroupSettings

type FleetLockConfiger added in v0.0.2

type FleetLockConfiger interface {
	GetConfig(ctx context.Context) (FleetLockHashedConfig, error)
	GetLockers(ctx context.Context) (map[string]FleetLocker, error)
	GetNotifierChan(ctx context.Context) (interface{}, error)
	AddGroup(ctx context.Context, group string, totalSlots int, staleAge Duration, permissions map[string]string) error
	DelGroup(ctx context.Context, group string) error
}

type FleetLockError

type FleetLockError struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

The error format expected for FleetLock requests https://coreos.github.io/zincati/development/fleetlock/protocol/#errors

type FleetLockHashedConfig added in v0.0.2

type FleetLockHashedConfig map[string]HashedGroupSettings

func NewHashedConfig added in v0.0.2

func NewHashedConfig(flc FleetLockConfig, argonSettings hashing.ArgonSettings) (FleetLockHashedConfig, error)

type FleetLocker

type FleetLocker interface {
	RecursiveLock(ctx context.Context, id string) error
	UnlockIfHeld(ctx context.Context, id string) error
	Group() string
	LockStatus(ctx context.Context) (LockStatus, error)
}

The core operations implemented by a FleetLock backend https://coreos.github.io/zincati/development/fleetlock/protocol/#overview

type GroupSettings added in v0.0.2

type GroupSettings struct {
	CommonGroupSettings
	Permissions map[string]string `json:"permissions" example:"*:changeme"`
}

"example" and "swaggerype" tags are used by swaggo/swag for creating docs

type HashedGroupSettings added in v0.0.2

type HashedGroupSettings struct {
	CommonGroupSettings
	HashedPermissions map[string]hashing.HashedPassword `json:"permissions" example:"*:changeme"`
}

type HashedPassword added in v0.0.2

type HashedPassword struct {
	Hash []byte
	Salt []byte
}

type Holder

type Holder struct {
	ID       string    `json:"id"`
	LockTime time.Time `json:"lock_time"`
	StaleAge Duration  `json:"stale_age"`
}

type LockStatus

type LockStatus struct {
	TotalSlots int      `json:"total_slots"`
	Holders    []Holder `json:"holders"`
}

Returns status information regarding the lock. Useful for monitoring but is not part of the FleetLock protocol

type RecursiveLockError added in v0.0.2

type RecursiveLockError struct {
	ClientMsg     string
	AllSlotsTaken bool
}

Type that satisfies the "error" interface. If the caller gets this type of error it can trust the message in clientMsg is safe to send to the client as-is in a FleetLockError value.

func (*RecursiveLockError) Error added in v0.0.2

func (le *RecursiveLockError) Error() string

Jump to

Keyboard shortcuts

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