Documentation ¶
Overview ¶
Package checked is a generated GoMock package.
Package checked implements reference counted resources.
Index ¶
- func DisableLeakDetection()
- func DisableTracebacks()
- func DumpLeaks() []string
- func EnableLeakDetection()
- func EnableTracebacks()
- func Panic(e error)
- func ResetPanicFn()
- func SetPanicFn(fn PanicFn)
- func SetTracebackCycles(value int)
- func SetTracebackMaxDepth(frames int)
- type Bytes
- type BytesFinalizer
- type BytesFinalizerFn
- type BytesOptions
- type MockBytes
- func (m *MockBytes) Append(arg0 byte)
- func (m *MockBytes) AppendAll(arg0 []byte)
- func (m *MockBytes) Bytes() []byte
- func (m *MockBytes) Cap() int
- func (m *MockBytes) DecReads()
- func (m *MockBytes) DecRef()
- func (m *MockBytes) DecWrites()
- func (m *MockBytes) DelayFinalizer() resource.SimpleCloser
- func (m *MockBytes) EXPECT() *MockBytesMockRecorder
- func (m *MockBytes) Finalize()
- func (m *MockBytes) IncReads()
- func (m *MockBytes) IncRef()
- func (m *MockBytes) IncWrites()
- func (m *MockBytes) Len() int
- func (m *MockBytes) MoveRef()
- func (m *MockBytes) NumReaders() int
- func (m *MockBytes) NumRef() int
- func (m *MockBytes) NumWriters() int
- func (m *MockBytes) Reset(arg0 []byte)
- func (m *MockBytes) Resize(arg0 int)
- type MockBytesMockRecorder
- func (mr *MockBytesMockRecorder) Append(arg0 interface{}) *gomock.Call
- func (mr *MockBytesMockRecorder) AppendAll(arg0 interface{}) *gomock.Call
- func (mr *MockBytesMockRecorder) Bytes() *gomock.Call
- func (mr *MockBytesMockRecorder) Cap() *gomock.Call
- func (mr *MockBytesMockRecorder) DecReads() *gomock.Call
- func (mr *MockBytesMockRecorder) DecRef() *gomock.Call
- func (mr *MockBytesMockRecorder) DecWrites() *gomock.Call
- func (mr *MockBytesMockRecorder) DelayFinalizer() *gomock.Call
- func (mr *MockBytesMockRecorder) Finalize() *gomock.Call
- func (mr *MockBytesMockRecorder) IncReads() *gomock.Call
- func (mr *MockBytesMockRecorder) IncRef() *gomock.Call
- func (mr *MockBytesMockRecorder) IncWrites() *gomock.Call
- func (mr *MockBytesMockRecorder) Len() *gomock.Call
- func (mr *MockBytesMockRecorder) MoveRef() *gomock.Call
- func (mr *MockBytesMockRecorder) NumReaders() *gomock.Call
- func (mr *MockBytesMockRecorder) NumRef() *gomock.Call
- func (mr *MockBytesMockRecorder) NumWriters() *gomock.Call
- func (mr *MockBytesMockRecorder) Reset(arg0 interface{}) *gomock.Call
- func (mr *MockBytesMockRecorder) Resize(arg0 interface{}) *gomock.Call
- type OnFinalize
- type OnFinalizeFn
- type PanicFn
- type Read
- type ReadWriteRef
- type Ref
- type RefCount
- func (c *RefCount) Close()
- func (c *RefCount) DecReads()
- func (c *RefCount) DecRef()
- func (c *RefCount) DecWrites()
- func (c *RefCount) DelayFinalizer() xresource.SimpleCloser
- func (c *RefCount) Finalize()
- func (c *RefCount) IncReads()
- func (c *RefCount) IncRef()
- func (c *RefCount) IncWrites()
- func (c *RefCount) MoveRef()
- func (c *RefCount) NumReaders() int
- func (c *RefCount) NumRef() int
- func (c *RefCount) NumWriters() int
- func (c *RefCount) OnFinalize() OnFinalize
- func (c *RefCount) SetOnFinalize(f OnFinalize)
- func (c *RefCount) TrackObject(v interface{})
- type Write
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 EnableTracebacks ¶
func EnableTracebacks()
EnableTracebacks turns traceback collection for events on
func ResetPanicFn ¶
func ResetPanicFn()
ResetPanicFn resets the panic function to the default runtime panic
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) DelayFinalizer ¶ added in v0.15.0
func (m *MockBytes) DelayFinalizer() resource.SimpleCloser
DelayFinalizer mocks base method.
func (*MockBytes) EXPECT ¶
func (m *MockBytes) EXPECT() *MockBytesMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
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) DelayFinalizer ¶ added in v0.15.0
func (mr *MockBytesMockRecorder) DelayFinalizer() *gomock.Call
DelayFinalizer indicates an expected call of DelayFinalizer.
func (*MockBytesMockRecorder) Finalize ¶
func (mr *MockBytesMockRecorder) Finalize() *gomock.Call
Finalize indicates an expected call of Finalize.
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.
type OnFinalize ¶ added in v0.15.0
type OnFinalize interface {
OnFinalize()
}
OnFinalize is callback to cleanup resources on a call to finalize.
type OnFinalizeFn ¶ added in v0.15.0
type OnFinalizeFn func()
OnFinalizeFn is a function literal that is a finalizer callback.
func (OnFinalizeFn) OnFinalize ¶ added in v0.15.0
func (fn OnFinalizeFn) OnFinalize()
OnFinalize will call the function literal as a finalizer callback.
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 ¶
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 // DelayFinalizer will delay calling the finalizer on this entity // until the closer returned by the method is called at least once. // This is useful for dependent resources requiring the lifetime of this // entityt to be extended. DelayFinalizer() xresource.SimpleCloser // Finalize will call the finalizer if any, ref count must be zero. Finalize() }
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) Close ¶ added in v0.15.0
func (c *RefCount) Close()
Close implements xresource.SimpleCloser for the purpose of use with DelayFinalizer.
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) DelayFinalizer ¶ added in v0.15.0
func (c *RefCount) DelayFinalizer() xresource.SimpleCloser
DelayFinalizer will delay calling the finalizer on this entity until the closer returned by the method is called at least once. This is useful for dependent resources requiring the lifetime of this entityt to be extended.
func (*RefCount) Finalize ¶
func (c *RefCount) Finalize()
Finalize will call the finalizer if any, ref count must be zero.
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 ¶
NumReaders returns the active reads count to this entity.
func (*RefCount) NumWriters ¶
NumWriters returns the active writes count to this entity.
func (*RefCount) OnFinalize ¶ added in v0.15.0
func (c *RefCount) OnFinalize() OnFinalize
OnFinalize returns the finalizer callback if any or nil otherwise.
func (*RefCount) SetOnFinalize ¶ added in v0.15.0
func (c *RefCount) SetOnFinalize(f OnFinalize)
SetOnFinalize sets the finalizer callback.
func (*RefCount) TrackObject ¶
func (c *RefCount) TrackObject(v interface{})
TrackObject sets up the initial internal state of the Ref for leak detection.