keyvalue

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Closest

func Closest(req index.Request) ([]byte, []byte)

func ClosestWithPrefix

func ClosestWithPrefix(req index.Request, prefix string) ([]byte, []byte)

func Key

func Key(key string) []byte

func KeyWithPrefix

func KeyWithPrefix(key string, prefix string) []byte

func MarshalCdx

func MarshalCdx(r index.Record) (key []byte, value []byte, err error)

func MarshalCdxWithPrefix

func MarshalCdxWithPrefix(r index.Record, prefix string) (key []byte, value []byte, err error)

MarshalCdxWithPrefix takes a record and returns a key-value pair for the cdx index.

func MarshalFileInfo

func MarshalFileInfo(fileInfo *schema.FileInfo, prefix string) (key []byte, value []byte, err error)

MarshalFileInfo takes a fileinfo and returns a key-value pair for the file index.

func MarshalId

func MarshalId(r index.Record, prefix string) (key []byte, value []byte, err error)

MarshalId takes a record and returns a key-value pair for the id index.

func MarshalReport

func MarshalReport(report *schema.Report, prefix string) (key []byte, value []byte, err error)

MarshalReport takes a report and returns a key-value pair for the report index.

func SearchKey

func SearchKey(req index.Request) []byte

func SearchKeyWithPrefix

func SearchKeyWithPrefix(req index.Request, prefix string) []byte

func SplitSSURT

func SplitSSURT(ssurt string) (surtHost string, portSchemeUserInfo string, path string)

Types

type CdxKey

type CdxKey []byte

CdxKey is a wrapper around the key used in the cdx index The key consists of the following parts separated by a space character: 1. surt domain and path (<surt domain>/<path>) 2. timestamp (14 digits) 3. port, scheme and userinfo (port:scheme@userinfo:) 4. response type (response)

Example:

test,example,/path 20200101000000 8080:http@user:password: response

func (CdxKey) Domain

func (ck CdxKey) Domain() string

func (CdxKey) Path

func (ck CdxKey) Path() string

func (CdxKey) Port

func (ck CdxKey) Port() string

func (CdxKey) PortSchemeUserInfo

func (ck CdxKey) PortSchemeUserInfo() string

func (CdxKey) ResponseType

func (ck CdxKey) ResponseType() string

func (CdxKey) Scheme

func (ck CdxKey) Scheme() string

func (CdxKey) String

func (ck CdxKey) String() string

func (CdxKey) Time

func (ck CdxKey) Time() time.Time

func (CdxKey) Unix

func (ck CdxKey) Unix() int64

Unix returns the time part of the key as unix time.

func (CdxKey) UserInfo

func (ck CdxKey) UserInfo() string

type CdxResponse

type CdxResponse struct {
	Key   CdxKey
	Value *schema.Cdx
	Error error
}

CdxResponse implements the index.CdxResponse interface.

func (CdxResponse) GetCdx

func (cr CdxResponse) GetCdx() *schema.Cdx

func (CdxResponse) GetError

func (cr CdxResponse) GetError() error

func (CdxResponse) GetKey

func (cr CdxResponse) GetKey() CdxKey

func (CdxResponse) MarshalJSON

func (cr CdxResponse) MarshalJSON() ([]byte, error)

type DebugAPI

type DebugAPI interface {
	Debug(context.Context, DebugRequest, chan<- CdxResponse) error
}

type DebugRequest

type DebugRequest struct {
	Key string
	index.Request
}

type FileInfoResponse

type FileInfoResponse struct {
	FileInfo *schema.FileInfo
	Error    error
}

FileInfoResponse implements the index.FileInfoResponse interface.

func (FileInfoResponse) GetError

func (fir FileInfoResponse) GetError() error

func (FileInfoResponse) GetFileInfo

func (fir FileInfoResponse) GetFileInfo() *schema.FileInfo

type IdResponse

type IdResponse struct {
	Key   string
	Value string
	Error error
}

IdResponse implements the index.IdResponse interface.

func (IdResponse) GetError

func (ir IdResponse) GetError() error

func (IdResponse) GetId

func (ir IdResponse) GetId() string

func (IdResponse) GetValue

func (ir IdResponse) GetValue() string

type ReportGenerator

type ReportGenerator struct {
	Id              string
	UpdateInterval  time.Duration
	UpdateThreshold int
	index.ReportGenerator
}

func NewReportGenerator

func NewReportGenerator(g index.ReportGenerator) (*ReportGenerator, error)

func (ReportGenerator) Generate

func (r ReportGenerator) Generate(ctx context.Context, req index.Request) (*schema.Report, error)

type ReportResponse

type ReportResponse struct {
	Value *schema.Report
	Error error
}

ReportResponse implements the index.ReportResponse interface.

func (ReportResponse) GetError

func (rr ReportResponse) GetError() error

func (ReportResponse) GetReport

func (rr ReportResponse) GetReport() *schema.Report

Jump to

Keyboard shortcuts

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