state

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package state provides representations of the state of a quotascheduler app, as well as transformations that run on a state and ways to persist the state, and emits metrics about the state or its transitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchRunner

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

BatchRunner runs operations in batches.

Requests within a batch are handled in a single read-modify-write transaction, in priority order.

All public methods of BatchRunner are threadsafe.

func NewBatchRunnerForTest

func NewBatchRunnerForTest() *BatchRunner

NewBatchRunnerForTest creates a Batcher for testing purposes.

On a batcher instance created with NewBatchRunnerForTest, the batcher requires calls to TBatchWait and TBatchClose to allow requests to be enqueued and for batches to be allowed to close.

func NewBatcher

func NewBatcher(poolID string) *BatchRunner

NewBatcher creates a new BatchRunner.

func (*BatchRunner) Assign

Assign runs the given assign request in a batch.

func (*BatchRunner) Close

func (b *BatchRunner) Close()

Close closes a BatchRunner, and waits for it to finish closing.

Any requests that were previously enqueued to this batcher will be allowed to complete. Attempting to send any new requests to this batcher after calling Close will panic.

func (*BatchRunner) Notify

Notify runs the given notify request in a batch.

func (*BatchRunner) Start

func (b *BatchRunner) Start(store *nodestore.NodeStore)

Start starts a BatchRunner (if it hasn't been started already).

It returns immediately.

func (*BatchRunner) TBatchStart

func (b *BatchRunner) TBatchStart()

TBatchStart allows a new batch to start executing, and blocks until it does so.

This is to be used only by tests, on Batcher instances created with NewBatchRunnerForTest.

func (*BatchRunner) TBatchWait

func (b *BatchRunner) TBatchWait(requests int)

TBatchWait blocks until the given number of requests have been included in a batch.

This is to be used only by tests, on Batcher instances created with NewBatchRunnerForTest. Otherwise, this method panics.

type NodeStoreOperationRunner

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

NodeStoreOperationRunner is a nodestore.Operator implementation for state.Operation.

func NewNodeStoreOperationRunner

func NewNodeStoreOperationRunner(op types.Operation, poolID string) *NodeStoreOperationRunner

NewNodeStoreOperationRunner returns a new operation runner for the given operation.

func (*NodeStoreOperationRunner) Commit

Commit implements nodestore.Operator.

func (*NodeStoreOperationRunner) Finish

func (n *NodeStoreOperationRunner) Finish(ctx context.Context)

Finish implements nodestore.Operator.

func (*NodeStoreOperationRunner) Modify

Modify implements nodestore.Operator.

Directories

Path Synopsis
Package metrics provides functions to emit ts_mon and bq metrics.
Package metrics provides functions to emit ts_mon and bq metrics.
Package nodestore implements a datastore-backed persistent store of qscheduler state, that shards state over as many entities as necessary to stay under datastore's single-entity size limit, and uses an in-memory cache to avoid unnecessary datastore reads.
Package nodestore implements a datastore-backed persistent store of qscheduler state, that shards state over as many entities as necessary to stay under datastore's single-entity size limit, and uses an in-memory cache to avoid unnecessary datastore reads.
internal/blob
Package blob defines the proto format used by nodestore.
Package blob defines the proto format used by nodestore.

Jump to

Keyboard shortcuts

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