middleware

package
v0.0.0-...-e9451bc Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GCSDelays = DelayOptions{
	MetaRead:       Latency{22 * time.Millisecond, 7 * time.Millisecond},
	MetaWrite:      Latency{31 * time.Millisecond, 8 * time.Millisecond},
	ObjRead:        Latency{57 * time.Millisecond, 7 * time.Millisecond},
	ObjWrite:       Latency{70 * time.Millisecond, 15 * time.Millisecond},
	List:           Latency{10 * time.Millisecond, 3 * time.Millisecond},
	SameObjWritePs: 1,
}

Functions

This section is empty.

Types

type BackendLogger

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

func NewBackendLogger

func NewBackendLogger(inner backend.Backend, id string, log *slog.Logger) BackendLogger

func (BackendLogger) Delete

func (b BackendLogger) Delete(ctx context.Context, path string) error

func (BackendLogger) DeleteIf

func (b BackendLogger) DeleteIf(
	ctx context.Context,
	path string,
	expected backend.Version,
) error

func (BackendLogger) GetMetadata

func (b BackendLogger) GetMetadata(
	ctx context.Context,
	path string,
) (backend.Metadata, error)

func (BackendLogger) List

func (b BackendLogger) List(ctx context.Context, dirPath string) (backend.ListIter, error)

func (BackendLogger) Read

func (b BackendLogger) Read(ctx context.Context, path string) (backend.ReadReply, error)

func (BackendLogger) ReadIfModified

func (b BackendLogger) ReadIfModified(
	ctx context.Context,
	path string,
	version int64,
) (backend.ReadReply, error)

func (BackendLogger) SetTagsIf

func (b BackendLogger) SetTagsIf(
	ctx context.Context,
	path string,
	expected backend.Version,
	t backend.Tags,
) (backend.Metadata, error)

func (BackendLogger) Write

func (b BackendLogger) Write(
	ctx context.Context,
	path string,
	value []byte,
	t backend.Tags,
) (backend.Metadata, error)

func (BackendLogger) WriteIf

func (b BackendLogger) WriteIf(
	ctx context.Context,
	path string,
	value []byte,
	expected backend.Version,
	t backend.Tags,
) (backend.Metadata, error)

func (BackendLogger) WriteIfNotExists

func (b BackendLogger) WriteIfNotExists(
	ctx context.Context,
	path string,
	value []byte,
	t backend.Tags,
) (backend.Metadata, error)

type DelayBackend

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

func NewDelayBackend

func NewDelayBackend(
	inner backend.Backend,
	clock clockwork.Clock,
	opts DelayOptions,
) *DelayBackend

func (*DelayBackend) Delete

func (b *DelayBackend) Delete(ctx context.Context, path string) error

func (*DelayBackend) DeleteIf

func (b *DelayBackend) DeleteIf(
	ctx context.Context,
	path string,
	expected backend.Version,
) error

func (*DelayBackend) GetMetadata

func (b *DelayBackend) GetMetadata(
	ctx context.Context,
	path string,
) (backend.Metadata, error)

func (*DelayBackend) List

func (b *DelayBackend) List(ctx context.Context, dirPath string) (backend.ListIter, error)

func (*DelayBackend) Read

func (b *DelayBackend) Read(ctx context.Context, path string) (backend.ReadReply, error)

func (*DelayBackend) ReadIfModified

func (b *DelayBackend) ReadIfModified(
	ctx context.Context,
	path string,
	version int64,
) (backend.ReadReply, error)

func (*DelayBackend) SetTagsIf

func (b *DelayBackend) SetTagsIf(
	ctx context.Context,
	path string,
	expected backend.Version,
	t backend.Tags,
) (backend.Metadata, error)

func (*DelayBackend) Write

func (b *DelayBackend) Write(
	ctx context.Context,
	path string,
	value []byte,
	t backend.Tags,
) (backend.Metadata, error)

func (*DelayBackend) WriteIf

func (b *DelayBackend) WriteIf(
	ctx context.Context,
	path string,
	value []byte,
	expected backend.Version,
	t backend.Tags,
) (backend.Metadata, error)

func (*DelayBackend) WriteIfNotExists

func (b *DelayBackend) WriteIfNotExists(
	ctx context.Context,
	path string,
	value []byte,
	t backend.Tags,
) (backend.Metadata, error)

type DelayOptions

type DelayOptions struct {
	MetaRead  Latency
	MetaWrite Latency
	ObjRead   Latency
	ObjWrite  Latency
	List      Latency
	// How many writes per second to the same object before being
	// rate limited?
	SameObjWritePs int
}

type Latency

type Latency struct {
	Mean   time.Duration
	StdDev time.Duration
}

Jump to

Keyboard shortcuts

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