checked

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 10 Imported by: 46

Documentation

Overview

Package checked is a generated GoMock package.

Package checked implements reference counted resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLeakDetection

func DisableLeakDetection()

DisableLeakDetection turns leak detection off.

func DisableTracebacks

func DisableTracebacks()

DisableTracebacks turns traceback collection for events off

func DumpLeaks

func DumpLeaks() []string

DumpLeaks returns all detected leaks so far.

func EnableLeakDetection

func EnableLeakDetection()

EnableLeakDetection turns leak detection on.

func EnableTracebacks

func EnableTracebacks()

EnableTracebacks turns traceback collection for events on

func Panic

func Panic(e error)

Panic will execute the currently set panic function

func ResetPanicFn

func ResetPanicFn()

ResetPanicFn resets the panic function to the default runtime panic

func SetPanicFn

func SetPanicFn(fn PanicFn)

SetPanicFn sets the panic function

func SetTracebackCycles

func SetTracebackCycles(value int)

SetTracebackCycles sets the count of traceback cycles to keep if enabled

func SetTracebackMaxDepth

func SetTracebackMaxDepth(frames int)

SetTracebackMaxDepth sets the max amount of frames to capture for traceback

Types

type Bytes

type Bytes interface {
	ReadWriteRef

	// Bytes returns an unchecked reference to the underlying bytes, callers
	// should discard the reference immediately after use and the use of
	// the reference must not extend past the lifetime of the checked bytes
	// itself.
	Bytes() []byte

	// Cap returns capacity of the bytes.
	Cap() int

	// Len returns the length of the bytes.
	Len() int

	// Resize will resize the bytes slice, this allows for reuse of the already
	// allocated bytes slices.
	Resize(size int)

	// Append will append a single byte to the bytes slice.
	Append(value byte)

	// AppendAll will append bytes to the bytes slice.
	AppendAll(values []byte)

	// Reset will reset the reference referred to by the bytes.
	Reset(v []byte)
}

Bytes is a checked byte slice.

func NewBytes

func NewBytes(value []byte, opts BytesOptions) Bytes

NewBytes returns a new checked byte slice.

type BytesFinalizer

type BytesFinalizer interface {
	FinalizeBytes(b Bytes)
}

BytesFinalizer finalizes a checked byte slice.

type BytesFinalizerFn

type BytesFinalizerFn func(b Bytes)

BytesFinalizerFn is a function literal that is a bytes finalizer.

func (BytesFinalizerFn) FinalizeBytes

func (fn BytesFinalizerFn) FinalizeBytes(b Bytes)

FinalizeBytes will call the function literal as a bytes finalizer.

type BytesOptions

type BytesOptions interface {
	// Finalizer is a bytes finalizer to call when finalized.
	Finalizer() BytesFinalizer

	// SetFinalizer sets a bytes finalizer to call when finalized.
	SetFinalizer(value BytesFinalizer) BytesOptions
}

BytesOptions is a bytes option

func NewBytesOptions

func NewBytesOptions() BytesOptions

NewBytesOptions returns a new set of bytes options.

type MockBytes

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

MockBytes is a mock of Bytes interface

func NewMockBytes

func NewMockBytes(ctrl *gomock.Controller) *MockBytes

NewMockBytes creates a new mock instance

func (*MockBytes) Append

func (m *MockBytes) Append(arg0 byte)

Append mocks base method

func (*MockBytes) AppendAll

func (m *MockBytes) AppendAll(arg0 []byte)

AppendAll mocks base method

func (*MockBytes) Bytes

func (m *MockBytes) Bytes() []byte

Bytes mocks base method

func (*MockBytes) Cap

func (m *MockBytes) Cap() int

Cap mocks base method

func (*MockBytes) DecReads

func (m *MockBytes) DecReads()

DecReads mocks base method

func (*MockBytes) DecRef

func (m *MockBytes) DecRef()

DecRef mocks base method

func (*MockBytes) DecWrites

func (m *MockBytes) DecWrites()

DecWrites mocks base method

func (*MockBytes) EXPECT

func (m *MockBytes) EXPECT() *MockBytesMockRecorder

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

func (*MockBytes) Finalize

func (m *MockBytes) Finalize()

Finalize mocks base method

func (*MockBytes) Finalizer

func (m *MockBytes) Finalizer() resource.Finalizer

Finalizer mocks base method

func (*MockBytes) IncReads

func (m *MockBytes) IncReads()

IncReads mocks base method

func (*MockBytes) IncRef

func (m *MockBytes) IncRef()

IncRef mocks base method

func (*MockBytes) IncWrites

func (m *MockBytes) IncWrites()

IncWrites mocks base method

func (*MockBytes) Len

func (m *MockBytes) Len() int

Len mocks base method

func (*MockBytes) MoveRef

func (m *MockBytes) MoveRef()

MoveRef mocks base method

func (*MockBytes) NumReaders

func (m *MockBytes) NumReaders() int

NumReaders mocks base method

func (*MockBytes) NumRef

func (m *MockBytes) NumRef() int

NumRef mocks base method

func (*MockBytes) NumWriters

func (m *MockBytes) NumWriters() int

NumWriters mocks base method

func (*MockBytes) Reset

func (m *MockBytes) Reset(arg0 []byte)

Reset mocks base method

func (*MockBytes) Resize

func (m *MockBytes) Resize(arg0 int)

Resize mocks base method

func (*MockBytes) SetFinalizer

func (m *MockBytes) SetFinalizer(arg0 resource.Finalizer)

SetFinalizer mocks base method

func (*MockBytes) TrackObject

func (m *MockBytes) TrackObject(arg0 interface{})

TrackObject mocks base method

type MockBytesMockRecorder

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

MockBytesMockRecorder is the mock recorder for MockBytes

func (*MockBytesMockRecorder) Append

func (mr *MockBytesMockRecorder) Append(arg0 interface{}) *gomock.Call

Append indicates an expected call of Append

func (*MockBytesMockRecorder) AppendAll

func (mr *MockBytesMockRecorder) AppendAll(arg0 interface{}) *gomock.Call

AppendAll indicates an expected call of AppendAll

func (*MockBytesMockRecorder) Bytes

func (mr *MockBytesMockRecorder) Bytes() *gomock.Call

Bytes indicates an expected call of Bytes

func (*MockBytesMockRecorder) Cap

func (mr *MockBytesMockRecorder) Cap() *gomock.Call

Cap indicates an expected call of Cap

func (*MockBytesMockRecorder) DecReads

func (mr *MockBytesMockRecorder) DecReads() *gomock.Call

DecReads indicates an expected call of DecReads

func (*MockBytesMockRecorder) DecRef

func (mr *MockBytesMockRecorder) DecRef() *gomock.Call

DecRef indicates an expected call of DecRef

func (*MockBytesMockRecorder) DecWrites

func (mr *MockBytesMockRecorder) DecWrites() *gomock.Call

DecWrites indicates an expected call of DecWrites

func (*MockBytesMockRecorder) Finalize

func (mr *MockBytesMockRecorder) Finalize() *gomock.Call

Finalize indicates an expected call of Finalize

func (*MockBytesMockRecorder) Finalizer

func (mr *MockBytesMockRecorder) Finalizer() *gomock.Call

Finalizer indicates an expected call of Finalizer

func (*MockBytesMockRecorder) IncReads

func (mr *MockBytesMockRecorder) IncReads() *gomock.Call

IncReads indicates an expected call of IncReads

func (*MockBytesMockRecorder) IncRef

func (mr *MockBytesMockRecorder) IncRef() *gomock.Call

IncRef indicates an expected call of IncRef

func (*MockBytesMockRecorder) IncWrites

func (mr *MockBytesMockRecorder) IncWrites() *gomock.Call

IncWrites indicates an expected call of IncWrites

func (*MockBytesMockRecorder) Len

func (mr *MockBytesMockRecorder) Len() *gomock.Call

Len indicates an expected call of Len

func (*MockBytesMockRecorder) MoveRef

func (mr *MockBytesMockRecorder) MoveRef() *gomock.Call

MoveRef indicates an expected call of MoveRef

func (*MockBytesMockRecorder) NumReaders

func (mr *MockBytesMockRecorder) NumReaders() *gomock.Call

NumReaders indicates an expected call of NumReaders

func (*MockBytesMockRecorder) NumRef

func (mr *MockBytesMockRecorder) NumRef() *gomock.Call

NumRef indicates an expected call of NumRef

func (*MockBytesMockRecorder) NumWriters

func (mr *MockBytesMockRecorder) NumWriters() *gomock.Call

NumWriters indicates an expected call of NumWriters

func (*MockBytesMockRecorder) Reset

func (mr *MockBytesMockRecorder) Reset(arg0 interface{}) *gomock.Call

Reset indicates an expected call of Reset

func (*MockBytesMockRecorder) Resize

func (mr *MockBytesMockRecorder) Resize(arg0 interface{}) *gomock.Call

Resize indicates an expected call of Resize

func (*MockBytesMockRecorder) SetFinalizer

func (mr *MockBytesMockRecorder) SetFinalizer(arg0 interface{}) *gomock.Call

SetFinalizer indicates an expected call of SetFinalizer

func (*MockBytesMockRecorder) TrackObject

func (mr *MockBytesMockRecorder) TrackObject(arg0 interface{}) *gomock.Call

TrackObject indicates an expected call of TrackObject

type PanicFn

type PanicFn func(e error)

PanicFn is a panic function to call on invalid checked state

type Read

type Read interface {
	// IncReads increments the reads count to this entity.
	IncReads()

	// DecReads decrements the reads count to this entity.
	DecReads()

	// NumReaders returns the active reads count to this entity.
	NumReaders() int
}

Read is an entity that checks reads.

type ReadWriteRef

type ReadWriteRef interface {
	Ref
	Read
	Write
}

ReadWriteRef is an entity that checks ref counts, reads and writes.

type Ref

type Ref interface {
	// IncRef increments the ref count to this entity.
	IncRef()

	// DecRef decrements the ref count to this entity.
	DecRef()

	// MoveRef signals a move of the ref to this entity.
	MoveRef()

	// NumRef returns the ref count to this entity.
	NumRef() int

	// Finalize will call the finalizer if any, ref count must be zero.
	Finalize()

	// Finalizer returns the finalizer if any or nil otherwise.
	Finalizer() resource.Finalizer

	// SetFinalizer sets the finalizer.
	SetFinalizer(f resource.Finalizer)

	// TrackObject sets up the initial internal state of the Ref for
	// leak detection.
	TrackObject(v interface{})
}

Ref is an entity that checks ref counts.

type RefCount

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

RefCount is an embeddable checked.Ref.

func (*RefCount) DecReads

func (c *RefCount) DecReads()

DecReads decrements the reads count to this entity.

func (*RefCount) DecRef

func (c *RefCount) DecRef()

DecRef decrements the reference count to this entity.

func (*RefCount) DecWrites

func (c *RefCount) DecWrites()

DecWrites decrements the writes count to this entity.

func (*RefCount) Finalize

func (c *RefCount) Finalize()

Finalize will call the finalizer if any, ref count must be zero.

func (*RefCount) Finalizer

func (c *RefCount) Finalizer() resource.Finalizer

Finalizer returns the finalizer if any or nil otherwise.

func (*RefCount) IncReads

func (c *RefCount) IncReads()

IncReads increments the reads count to this entity.

func (*RefCount) IncRef

func (c *RefCount) IncRef()

IncRef increments the reference count to this entity.

func (*RefCount) IncWrites

func (c *RefCount) IncWrites()

IncWrites increments the writes count to this entity.

func (*RefCount) MoveRef

func (c *RefCount) MoveRef()

MoveRef signals a move of the ref to this entity.

func (*RefCount) NumReaders

func (c *RefCount) NumReaders() int

NumReaders returns the active reads count to this entity.

func (*RefCount) NumRef

func (c *RefCount) NumRef() int

NumRef returns the reference count to this entity.

func (*RefCount) NumWriters

func (c *RefCount) NumWriters() int

NumWriters returns the active writes count to this entity.

func (*RefCount) SetFinalizer

func (c *RefCount) SetFinalizer(f resource.Finalizer)

SetFinalizer sets the finalizer.

func (*RefCount) TrackObject

func (c *RefCount) TrackObject(v interface{})

TrackObject sets up the initial internal state of the Ref for leak detection.

type Write

type Write interface {
	// IncWrites increments the writes count to this entity.
	IncWrites()

	// DecWrites decrements the writes count to this entity.
	DecWrites()

	// NumWriters returns the active writes count to this entity.
	NumWriters() int
}

Write is an entity that checks writes.

Jump to

Keyboard shortcuts

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