reqstash

package
v0.0.0-...-1c51dc1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Storage struct {
		Capacity int           `envconfig:"capacity"`
		TTL      time.Duration `envconfig:"ttl"`
	} `envconfig:"storage"`
}

type MemoryStorage

type MemoryStorage struct {
	sync.RWMutex
	Capacity int
	TTL      time.Duration
	// contains filtered or unexported fields
}

func (*MemoryStorage) ListAll

func (s *MemoryStorage) ListAll() ([]Request, error)

func (*MemoryStorage) Purge

func (s *MemoryStorage) Purge() (int, error)

func (*MemoryStorage) Put

func (s *MemoryStorage) Put(req Request) error

type Purgable

type Purgable interface {
	Purge() (int, error)
}

type Request

type Request struct {
	Timestamp time.Time
	Method    string
	Host      string
	URL       string
	Header    map[string][]string
	Error     error
	Body      string
}

func NewRequest

func NewRequest(r *http.Request) Request

type Storage

type Storage interface {
	Put(req Request) error
	ListAll() ([]Request, error)
}

Jump to

Keyboard shortcuts

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