mongo

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package mongo provides a MongoDB implementation of the Bastion composite store using grove ORM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements store.Store using MongoDB via Grove ORM.

func New

func New(db *grove.DB) *Store

New creates a new MongoDB store backed by Grove ORM.

func (*Store) Allow

func (s *Store) Allow(ctx context.Context, key string, limit float64, burst int, _ time.Duration) (bool, error)

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) Delete

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

func (*Store) DeleteRoute

func (s *Store) DeleteRoute(ctx context.Context, routeID string) error

func (*Store) DeleteState

func (s *Store) DeleteState(ctx context.Context, targetID string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) ([]byte, error)

func (*Store) GetHistory

func (s *Store) GetHistory(ctx context.Context, targetID string, limit int) ([]bastion.HealthCheckResult, error)

func (*Store) GetLatestState

func (s *Store) GetLatestState(ctx context.Context, targetID string) (*bastion.HealthCheckResult, error)

func (*Store) GetRoute

func (s *Store) GetRoute(ctx context.Context, routeID string) (*bastion.Route, error)

func (*Store) GetState

func (s *Store) GetState(ctx context.Context, targetID string) (*bastion.CircuitBreakerSnapshot, error)

func (*Store) ListRoutes

func (s *Store) ListRoutes(ctx context.Context) ([]*bastion.Route, error)

func (*Store) ListStates

func (s *Store) ListStates(ctx context.Context) ([]*bastion.CircuitBreakerSnapshot, error)

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate creates indexes for all bastion collections.

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping checks database connectivity.

func (*Store) RecordCheck

func (s *Store) RecordCheck(ctx context.Context, result *bastion.HealthCheckResult) error

func (*Store) SaveRoute

func (s *Store) SaveRoute(ctx context.Context, route *bastion.Route) error

func (*Store) SaveState

func (s *Store) SaveState(ctx context.Context, snap *bastion.CircuitBreakerSnapshot) error

func (*Store) Set

func (s *Store) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

func (*Store) Write

func (s *Store) Write(ctx context.Context, event *bastion.AuditEvent) error

Jump to

Keyboard shortcuts

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