Documentation
¶
Index ¶
- type AcquireInput
- type AcquireOutput
- type AcquireOutputBody
- type Handler
- func (h *Handler) Acquire(ctx context.Context, input *AcquireInput) (*AcquireOutput, error)
- func (h *Handler) ConfigureMiddleware(router *fiber.App)
- func (h *Handler) Join(ctx context.Context, input *JoinInput) (*JoinOutput, error)
- func (h *Handler) RegisterRoutes(api huma.API)
- func (h *Handler) Release(ctx context.Context, input *ReleaseInput) (*ReleaseOutput, error)
- func (h *Handler) Renew(ctx context.Context, input *RenewInput) (*RenewOutput, error)
- type JoinInput
- type JoinOutput
- type Node
- type ReleaseInput
- type ReleaseInputBody
- type ReleaseOutput
- type ReleaseOutputBody
- type RenewInput
- type RenewInputBody
- type RenewOutput
- type RenewOutputBody
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcquireInput ¶
type AcquireInput struct {
Key string `path:"key" maxLength:"1024" example:"migration_lock:1" doc:"Key for the lock"`
Body struct {
Owner string `json:"owner,omitempty" example:"owner-1" doc:"Owner of the lock"`
TTL int64 `json:"ttl" default:"60" minimum:"1" example:"60" doc:"Time to live for the lock in seconds"`
}
}
type AcquireOutput ¶
type AcquireOutput struct {
Status int
Body AcquireOutputBody
}
type AcquireOutputBody ¶
type AcquireOutputBody struct {
Status string `json:"status" example:"ACQUIRED" doc:"Status of the acquire operation"`
Owner string `json:"owner,omitempty" example:"owner-1" doc:"Owner of the lock"`
FencingToken string `json:"fencing_token,omitempty" example:"1968688872162332700" doc:"Fencing token of the lock"`
ExpireAt time.Time `json:"expire_at" example:"2025-09-18T16:50:38+02:00" doc:"Expiration time of the lock"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Acquire ¶
func (h *Handler) Acquire(ctx context.Context, input *AcquireInput) (*AcquireOutput, error)
func (*Handler) ConfigureMiddleware ¶
func (*Handler) RegisterRoutes ¶
func (*Handler) Release ¶
func (h *Handler) Release(ctx context.Context, input *ReleaseInput) (*ReleaseOutput, error)
func (*Handler) Renew ¶
func (h *Handler) Renew(ctx context.Context, input *RenewInput) (*RenewOutput, error)
type JoinOutput ¶
type Node ¶
type Node interface {
// Acquire acquires a lock the given key if it wasn't acquired by somebody else.
Acquire(key, owner string, ttl int64) (*domain.LockEntry, error)
// Release releases a lock for the given key.
Release(key, owner string, fencingToken uint64) error
// Renew renews a lock for the given key.
Renew(key, owner string, fencingToken uint64, ttl int64) (*domain.LockEntry, error)
// Join joins the node, identitifed by nodeID and reachable at raftAddr, to the cluster.
Join(nodeID string, raftAddr string) error
NodeID() string
}
Node is the interface Raft-backed key-value stores must implement.
type ReleaseInput ¶
type ReleaseInput struct {
Key string `path:"key" maxLength:"1024" example:"migration_lock:1" doc:"Key for the lock"`
Body ReleaseInputBody
}
type ReleaseInputBody ¶
type ReleaseOutput ¶
type ReleaseOutput struct {
Status int
Body ReleaseOutputBody
}
type ReleaseOutputBody ¶
type ReleaseOutputBody struct {
Status string `json:"status" example:"RELEASED" doc:"Status of the release operation"`
}
type RenewInput ¶
type RenewInput struct {
Key string `path:"key" maxLength:"1024" example:"migration_lock:1" doc:"Key for the lock"`
Body RenewInputBody
}
type RenewInputBody ¶
type RenewInputBody struct {
Owner string `json:"owner" example:"owner-1" doc:"Owner of the lock"`
FencingToken string `json:"fencing_token" example:"1968688872162332700" doc:"Fencing token of the lock"`
TTL int64 `json:"ttl" default:"60" minimum:"1" example:"60" doc:"Time to live for the lock in seconds"`
}
type RenewOutput ¶
type RenewOutput struct {
Status int
Body RenewOutputBody
}
type RenewOutputBody ¶
type RenewOutputBody struct {
Status string `json:"status" example:"ACQUIRED" doc:"Status of the acquire operation"`
Owner string `json:"owner,omitempty" example:"owner-1" doc:"Owner of the lock"`
FencingToken string `json:"fencing_token,omitempty" example:"1968688872162332700" doc:"Fencing token of the lock"`
ExpireAt time.Time `json:"expire_at" example:"2025-09-18T16:50:38+02:00" doc:"Expiration time of the lock"`
}
Click to show internal directories.
Click to hide internal directories.