epstore

package
v1.167.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 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

Overview

Package epstore is the PostgreSQL store of endpoint bindings and the failed requests they answered (#2171, #2172): the script_endpoints and script_endpoint_failures tables of migration 000203.

Index

Constants

View Source
const (
	// MaxListLimit is the most bindings one page of a listing holds.
	MaxListLimit = 200
)

Listing bounds.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is the PostgreSQL binding store.

func New

func New(db *sql.DB) *Store

New returns a store over db.

func (*Store) ByScript added in v1.161.0

func (s *Store) ByScript(ctx context.Context, scriptID string) ([]epbinding.Binding, error)

ByScript returns a script's bindings by name.

func (*Store) Delete added in v1.161.0

func (s *Store) Delete(ctx context.Context, id string) error

Delete removes one binding; its failed and refused requests go with it.

func (*Store) Enable added in v1.161.0

func (s *Store) Enable(ctx context.Context, id string, enabled bool, actor string) error

Enable turns one binding on or off.

func (*Store) Failures

func (s *Store) Failures(ctx context.Context, endpointID string, limit int) ([]epbinding.Failure, error)

Failures returns an endpoint's most recent failed requests, newest first.

func (*Store) GetByID added in v1.161.0

func (s *Store) GetByID(ctx context.Context, id string) (*epbinding.Binding, error)

GetByID returns one binding.

func (*Store) GetByName

func (s *Store) GetByName(ctx context.Context, name string) (*epbinding.Binding, error)

GetByName returns the binding a name serves.

func (*Store) List

func (s *Store) List(ctx context.Context, filter epbinding.Filter) ([]epbinding.Binding, int, error)

List returns one page of the bindings matching the filter, by name, and how many match in all. A page past the last answers no bindings and the total, read with a second statement since no row carries it.

func (*Store) RecordFailure

func (s *Store) RecordFailure(ctx context.Context, f epbinding.Failure) error

RecordFailure keeps one failed request.

func (*Store) Set

func (s *Store) Set(ctx context.Context, b *epbinding.Binding) error

Set creates a binding when its ID is empty and replaces the one with its ID otherwise, keeping its creation stamp (#2441). The replace is held to the binding's own script, so an id read from another script's binding changes nothing.

func (*Store) Stamp

func (s *Store) Stamp(ctx context.Context, name string) (epbinding.Stamp, error)

Stamp reads when the binding a name serves and its script were last written, and the application the script is a part of.

func (*Store) SweepFailures

func (s *Store) SweepFailures(ctx context.Context, cutoff time.Time) (int64, error)

SweepFailures deletes the failures recorded before cutoff.

Jump to

Keyboard shortcuts

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