storage

package
v0.0.0-...-0b18c8e Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerFactory

func HandlerFactory(d Dumper) func(http.ResponseWriter, *http.Request)

HandlerFactory returns a (you guessed it) handler function suitable for passing to http.HandleFunc, which stores incoming request data using the provided Dumper.

func ProcessBatch

func ProcessBatch(b Batcher, p Processor) (int, error)

Types

type Batcher

type Batcher interface {
	MarkBatch() (batchID int64, err error)
	ReadRequests(batchID int64) (reqs []Request, err error)
	BatchDone(batchID int64) error
}

Batcher reads stored HTTP requests in a batch, marking them as processed when done.

type DumpBatcher

type DumpBatcher interface {
	Dumper
	Batcher
}

type Dumper

type Dumper interface {
	Dump(*Request) error
}

Dumper allows an incoming HTTP request to be stored locally, for more processing later on.

type Processor

type Processor interface {
	ProcessRequests(reqs []Request) error
}

Processor takes a list of HTTP requests and processes them somehow.

type Request

type Request struct {
	ID    *int64
	Head  []byte
	Data  []byte
	When  time.Time
	Batch *int
}

Request contains the various pieces of one http.Request, packaged up for easy reading or writing. The id field is intended to be read-only, to uniquely identify a request to Batcher.BatchDone.

func (*Request) String

func (req *Request) String() string

Directories

Path Synopsis
Package sqlite3 allows storing http request data in sqlite databases.
Package sqlite3 allows storing http request data in sqlite databases.

Jump to

Keyboard shortcuts

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