cost

package
v0.15.14 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cost is a generated GoMock package.

Index

Constants

View Source
const (
	// BlockLevel identifies per-block enforcers.
	BlockLevel = "block"
	// QueryLevel identifies per-query enforcers.
	QueryLevel = "query"
	// GlobalLevel identifies global enforcers.
	GlobalLevel = "global"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainedEnforcer

type ChainedEnforcer interface {
	cost.Enforcer

	// Child creates a new ChainedEnforcer which rolls up to this one.
	Child(resourceName string) ChainedEnforcer

	// Close indicates that all resources have been returned for this
	// ChainedEnforcer. It should inform all parent enforcers that the
	// resources have been freed.
	Close()
}

ChainedEnforcer is a cost.Enforcer implementation which tracks resource usage implements cost.Enforcer to enforce limits on multiple resources at once, linked together in a tree.

func NewChainedEnforcer

func NewChainedEnforcer(rootResourceName string, models []cost.Enforcer) (ChainedEnforcer, error)

NewChainedEnforcer constructs a chainedEnforcer which creates children using the provided models. models[0] enforces this instance; models[1] enforces the first level of children, and so on.

func NoopChainedEnforcer

func NoopChainedEnforcer() ChainedEnforcer

NoopChainedEnforcer returns a chainedEnforcer which enforces no limits and does no reporting.

type ChainedReporter

type ChainedReporter interface {
	cost.EnforcerReporter

	// OnChildClose is called whenever a child of this reporter's chainedEnforcer is released.
	OnChildClose(currentCost cost.Cost)

	// OnClose is called whenever this reporter's chainedEnforcer is released.
	OnClose(currentCost cost.Cost)
}

ChainedReporter is a listener for chainedEnforcer methods, which listens to Close events in addition to events used by cost.EnforcerReporter.

type MockChainedEnforcer

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

MockChainedEnforcer is a mock of ChainedEnforcer interface

func NewMockChainedEnforcer

func NewMockChainedEnforcer(ctrl *gomock.Controller) *MockChainedEnforcer

NewMockChainedEnforcer creates a new mock instance

func (*MockChainedEnforcer) Add

func (m *MockChainedEnforcer) Add(arg0 cost0.Cost) cost0.Report

Add mocks base method

func (*MockChainedEnforcer) Child

Child mocks base method

func (*MockChainedEnforcer) Clone

func (m *MockChainedEnforcer) Clone() cost0.Enforcer

Clone mocks base method

func (*MockChainedEnforcer) Close

func (m *MockChainedEnforcer) Close()

Close mocks base method

func (*MockChainedEnforcer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockChainedEnforcer) Limit

func (m *MockChainedEnforcer) Limit() cost0.Limit

Limit mocks base method

func (*MockChainedEnforcer) Reporter

Reporter mocks base method

func (*MockChainedEnforcer) State

func (m *MockChainedEnforcer) State() (cost0.Report, cost0.Limit)

State mocks base method

type MockChainedEnforcerMockRecorder

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

MockChainedEnforcerMockRecorder is the mock recorder for MockChainedEnforcer

func (*MockChainedEnforcerMockRecorder) Add

func (mr *MockChainedEnforcerMockRecorder) Add(arg0 interface{}) *gomock.Call

Add indicates an expected call of Add

func (*MockChainedEnforcerMockRecorder) Child

func (mr *MockChainedEnforcerMockRecorder) Child(arg0 interface{}) *gomock.Call

Child indicates an expected call of Child

func (*MockChainedEnforcerMockRecorder) Clone

Clone indicates an expected call of Clone

func (*MockChainedEnforcerMockRecorder) Close

Close indicates an expected call of Close

func (*MockChainedEnforcerMockRecorder) Limit

Limit indicates an expected call of Limit

func (*MockChainedEnforcerMockRecorder) Reporter

Reporter indicates an expected call of Reporter

func (*MockChainedEnforcerMockRecorder) State

State indicates an expected call of State

type MockChainedReporter

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

MockChainedReporter is a mock of ChainedReporter interface

func NewMockChainedReporter

func NewMockChainedReporter(ctrl *gomock.Controller) *MockChainedReporter

NewMockChainedReporter creates a new mock instance

func (*MockChainedReporter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockChainedReporter) OnChildClose

func (m *MockChainedReporter) OnChildClose(arg0 cost0.Cost)

OnChildClose mocks base method

func (*MockChainedReporter) OnClose

func (m *MockChainedReporter) OnClose(arg0 cost0.Cost)

OnClose mocks base method

func (*MockChainedReporter) ReportCost

func (m *MockChainedReporter) ReportCost(arg0 cost0.Cost)

ReportCost mocks base method

func (*MockChainedReporter) ReportCurrent

func (m *MockChainedReporter) ReportCurrent(arg0 cost0.Cost)

ReportCurrent mocks base method

func (*MockChainedReporter) ReportOverLimit

func (m *MockChainedReporter) ReportOverLimit(arg0 bool)

ReportOverLimit mocks base method

type MockChainedReporterMockRecorder

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

MockChainedReporterMockRecorder is the mock recorder for MockChainedReporter

func (*MockChainedReporterMockRecorder) OnChildClose

func (mr *MockChainedReporterMockRecorder) OnChildClose(arg0 interface{}) *gomock.Call

OnChildClose indicates an expected call of OnChildClose

func (*MockChainedReporterMockRecorder) OnClose

func (mr *MockChainedReporterMockRecorder) OnClose(arg0 interface{}) *gomock.Call

OnClose indicates an expected call of OnClose

func (*MockChainedReporterMockRecorder) ReportCost

func (mr *MockChainedReporterMockRecorder) ReportCost(arg0 interface{}) *gomock.Call

ReportCost indicates an expected call of ReportCost

func (*MockChainedReporterMockRecorder) ReportCurrent

func (mr *MockChainedReporterMockRecorder) ReportCurrent(arg0 interface{}) *gomock.Call

ReportCurrent indicates an expected call of ReportCurrent

func (*MockChainedReporterMockRecorder) ReportOverLimit

func (mr *MockChainedReporterMockRecorder) ReportOverLimit(arg0 interface{}) *gomock.Call

ReportOverLimit indicates an expected call of ReportOverLimit

Jump to

Keyboard shortcuts

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