Documentation ¶
Overview ¶
Package ident is a generated GoMock package.
Package ident provides utilities for working with identifiers.
Index ¶
- type BytesID
- type ID
- type IDMatcher
- type Iterator
- type MockID
- type MockIDMockRecorder
- func (mr *MockIDMockRecorder) Bytes() *gomock.Call
- func (mr *MockIDMockRecorder) Equal(arg0 interface{}) *gomock.Call
- func (mr *MockIDMockRecorder) Finalize() *gomock.Call
- func (mr *MockIDMockRecorder) IsNoFinalize() *gomock.Call
- func (mr *MockIDMockRecorder) NoFinalize() *gomock.Call
- func (mr *MockIDMockRecorder) String() *gomock.Call
- type MockTagIterator
- func (m *MockTagIterator) Close()
- func (m *MockTagIterator) Current() Tag
- func (m *MockTagIterator) CurrentIndex() int
- func (m *MockTagIterator) Duplicate() TagIterator
- func (m *MockTagIterator) EXPECT() *MockTagIteratorMockRecorder
- func (m *MockTagIterator) Err() error
- func (m *MockTagIterator) Len() int
- func (m *MockTagIterator) Next() bool
- func (m *MockTagIterator) Remaining() int
- type MockTagIteratorMockRecorder
- func (mr *MockTagIteratorMockRecorder) Close() *gomock.Call
- func (mr *MockTagIteratorMockRecorder) Current() *gomock.Call
- func (mr *MockTagIteratorMockRecorder) CurrentIndex() *gomock.Call
- func (mr *MockTagIteratorMockRecorder) Duplicate() *gomock.Call
- func (mr *MockTagIteratorMockRecorder) Err() *gomock.Call
- func (mr *MockTagIteratorMockRecorder) Len() *gomock.Call
- func (mr *MockTagIteratorMockRecorder) Next() *gomock.Call
- func (mr *MockTagIteratorMockRecorder) Remaining() *gomock.Call
- type Pool
- type PoolOptions
- type Tag
- type TagIterMatcher
- type TagIterator
- type TagMatcher
- type TagName
- type TagValue
- type Tags
- type TagsIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesID ¶
type BytesID []byte
BytesID is a small utility type to avoid the heavy weight of a true ID implementation when using in high throughput places like keys in a map.
func (BytesID) Finalize ¶
func (v BytesID) Finalize()
Finalize is a no-op for a bytes ID as it has no associated pool.
func (BytesID) IsNoFinalize ¶
IsNoFinalize is always true since BytesID is not pooled.
func (BytesID) NoFinalize ¶
func (v BytesID) NoFinalize()
NoFinalize is a no-op for a bytes ID as Finalize is already a no-op.
type ID ¶
type ID interface { fmt.Stringer // Bytes returns the underlying byte slice of the bytes ID unpacked from // any checked bytes container, callers cannot safely hold a ref to these // bytes. Bytes() []byte // Equal returns whether the ID is equal to a given ID. Equal(value ID) bool // NoFinalize makes calls to finalize a no-op, this is useful when you // would like to share a type with another sub-system that should is not // allowed to finalize the resource as the resource is kept indefinitely // until garbage collected (i.e. longly lived). NoFinalize() // IsNoFinalize returns whether finalize is a no-op or not, this is useful // when you know you can use an ID without having to worry to take a copy. IsNoFinalize() bool // Finalize releases all resources held by the ID, unless NoFinalize has // been called previously in which case this is a no-op. Finalize() }
ID represents an immutable identifier to allow use of byte slice pooling for the contents of the ID.
type Iterator ¶
type Iterator interface { // Next returns a bool indicating the presence of the next ID instance. Next() bool // Current returns the current ID instance. Current() ID // CurrentIndex returns the current index at. CurrentIndex() int // Close releases any resources held by the iterator. Close() // Err returns any errors encountered during iteration. Err() error // Len returns the number of elements. Len() int // Remaining returns the number of elements remaining to be iterated over. Remaining() int // Dupe returns an independent duplicate of the iterator. Duplicate() Iterator }
Iterator represents an iterator over `ID` instances. It is not thread-safe.
func NewIDSliceIterator ¶
NewIDSliceIterator returns a new Iterator over a slice.
func NewIDsIterator ¶
NewIDsIterator returns a new Iterator over the given IDs.
func NewStringIDsIterator ¶
NewStringIDsIterator returns a new Iterator over the given IDs.
func NewStringIDsSliceIterator ¶
NewStringIDsSliceIterator returns a new Iterator over a slice of strings.
type MockID ¶
type MockID struct {
// contains filtered or unexported fields
}
MockID is a mock of ID interface
func NewMockID ¶
func NewMockID(ctrl *gomock.Controller) *MockID
NewMockID creates a new mock instance
func (*MockID) EXPECT ¶
func (m *MockID) EXPECT() *MockIDMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockIDMockRecorder ¶
type MockIDMockRecorder struct {
// contains filtered or unexported fields
}
MockIDMockRecorder is the mock recorder for MockID
func (*MockIDMockRecorder) Bytes ¶
func (mr *MockIDMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes
func (*MockIDMockRecorder) Equal ¶
func (mr *MockIDMockRecorder) Equal(arg0 interface{}) *gomock.Call
Equal indicates an expected call of Equal
func (*MockIDMockRecorder) Finalize ¶
func (mr *MockIDMockRecorder) Finalize() *gomock.Call
Finalize indicates an expected call of Finalize
func (*MockIDMockRecorder) IsNoFinalize ¶
func (mr *MockIDMockRecorder) IsNoFinalize() *gomock.Call
IsNoFinalize indicates an expected call of IsNoFinalize
func (*MockIDMockRecorder) NoFinalize ¶
func (mr *MockIDMockRecorder) NoFinalize() *gomock.Call
NoFinalize indicates an expected call of NoFinalize
func (*MockIDMockRecorder) String ¶
func (mr *MockIDMockRecorder) String() *gomock.Call
String indicates an expected call of String
type MockTagIterator ¶
type MockTagIterator struct {
// contains filtered or unexported fields
}
MockTagIterator is a mock of TagIterator interface
func NewMockTagIterator ¶
func NewMockTagIterator(ctrl *gomock.Controller) *MockTagIterator
NewMockTagIterator creates a new mock instance
func (*MockTagIterator) CurrentIndex ¶
func (m *MockTagIterator) CurrentIndex() int
CurrentIndex mocks base method
func (*MockTagIterator) Duplicate ¶
func (m *MockTagIterator) Duplicate() TagIterator
Duplicate mocks base method
func (*MockTagIterator) EXPECT ¶
func (m *MockTagIterator) EXPECT() *MockTagIteratorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockTagIterator) Remaining ¶
func (m *MockTagIterator) Remaining() int
Remaining mocks base method
type MockTagIteratorMockRecorder ¶
type MockTagIteratorMockRecorder struct {
// contains filtered or unexported fields
}
MockTagIteratorMockRecorder is the mock recorder for MockTagIterator
func (*MockTagIteratorMockRecorder) Close ¶
func (mr *MockTagIteratorMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockTagIteratorMockRecorder) Current ¶
func (mr *MockTagIteratorMockRecorder) Current() *gomock.Call
Current indicates an expected call of Current
func (*MockTagIteratorMockRecorder) CurrentIndex ¶
func (mr *MockTagIteratorMockRecorder) CurrentIndex() *gomock.Call
CurrentIndex indicates an expected call of CurrentIndex
func (*MockTagIteratorMockRecorder) Duplicate ¶
func (mr *MockTagIteratorMockRecorder) Duplicate() *gomock.Call
Duplicate indicates an expected call of Duplicate
func (*MockTagIteratorMockRecorder) Err ¶
func (mr *MockTagIteratorMockRecorder) Err() *gomock.Call
Err indicates an expected call of Err
func (*MockTagIteratorMockRecorder) Len ¶
func (mr *MockTagIteratorMockRecorder) Len() *gomock.Call
Len indicates an expected call of Len
func (*MockTagIteratorMockRecorder) Next ¶
func (mr *MockTagIteratorMockRecorder) Next() *gomock.Call
Next indicates an expected call of Next
func (*MockTagIteratorMockRecorder) Remaining ¶
func (mr *MockTagIteratorMockRecorder) Remaining() *gomock.Call
Remaining indicates an expected call of Remaining
type Pool ¶
type Pool interface { // GetBinaryID will create a new binary ID and take reference to the bytes. // When the context closes the ID will be finalized and so too will // the bytes, i.e. it will take ownership of the bytes. GetBinaryID(c context.Context, data checked.Bytes) ID // BinaryID will create a new binary ID and take a reference to the bytes. BinaryID(data checked.Bytes) ID // GetBinaryTag will create a new binary Tag and take reference to the bytes. // When the context closes, the Tag will be finalized and so too will // the bytes, i.e. it will take ownership of the bytes. GetBinaryTag(c context.Context, name, value checked.Bytes) Tag // BinaryTag will create a new binary Tag and take a reference to the provided bytes. BinaryTag(name, value checked.Bytes) Tag // GetStringID will create a new string ID and create a bytes copy of the // string. When the context closes the ID will be finalized. GetStringID(c context.Context, id string) ID // StringID will create a new string ID and create a bytes copy of the // string. StringID(data string) ID // GetStringTag will create a new string Tag and create a bytes copy of the // string. When the context closes the ID will be finalized. GetStringTag(c context.Context, name, value string) Tag // StringTag will create a new string Tag and create a bytes copy of the // string. StringTag(name, value string) Tag // Tags will create a new array of tags and return it. Tags() Tags // GetTagsIterator will create a tag iterator and return it. When the context // closes the tags array and any tags contained will be finalized. GetTagsIterator(c context.Context) TagsIterator // TagsIterator will create a tag iterator and return it. TagsIterator() TagsIterator // Put an ID back in the pool. Put(id ID) // PutTag puts a tag back in the pool. PutTag(tag Tag) // PutTags puts a set of tags back in the pool. PutTags(tags Tags) // PutTagsIterator puts a tags iterator back in the pool. PutTagsIterator(iter TagsIterator) // Clone replicates a given ID into a pooled ID. Clone(id ID) ID // CloneTag replicates a given Tag into a pooled Tag. CloneTag(tag Tag) Tag // CloneTags replicates a given set of Tags into a pooled Tags. CloneTags(tags Tags) Tags }
Pool represents an automatic pool of `ident` objects.
func NewPool ¶
func NewPool( bytesPool pool.CheckedBytesPool, opts PoolOptions, ) Pool
NewPool constructs a new simple Pool.
type PoolOptions ¶
type PoolOptions struct { IDPoolOptions pool.ObjectPoolOptions TagsPoolOptions pool.ObjectPoolOptions TagsCapacity int TagsMaxCapacity int TagsIteratorPoolOptions pool.ObjectPoolOptions }
PoolOptions is a set of pooling options.
type Tag ¶
Tag represents a timeseries tag.
func (*Tag) Finalize ¶
func (t *Tag) Finalize()
Finalize releases all resources held by the Tag, unless NoFinalize has been called previously in which case this is a no-op.
func (*Tag) NoFinalize ¶
func (t *Tag) NoFinalize()
NoFinalize makes calls to finalize a no-op, this is useful when you would like to share a type with another sub-system that should is not allowed to finalize the resource as the resource is kept indefinitely until garbage collected (i.e. longly lived).
type TagIterMatcher ¶
TagIterMatcher is a gomock.Matcher that matches TagIterator
func NewTagIterMatcher ¶
func NewTagIterMatcher(iter TagIterator) TagIterMatcher
NewTagIterMatcher returns a new TagIterMatcher
type TagIterator ¶
type TagIterator interface { // Next returns a bool indicating the presence of the next Tag instance. Next() bool // Current returns the current Tag instance. Current() Tag // CurrentIndex returns the current index at. CurrentIndex() int // Err returns any errors encountered during iteration. Err() error // Close releases any resources held by the iterator. Close() // Len returns the number of elements. Len() int // Remaining returns the number of elements remaining to be iterated over. Remaining() int // Dupe returns an independent duplicate of the iterator. Duplicate() TagIterator }
TagIterator represents an iterator over `Tag` instances. It is not thread-safe.
var EmptyTagIterator TagIterator = emptyTagIterator{}
EmptyTagIterator returns an iterator over no tags.
func MustNewTagStringsIterator ¶
func MustNewTagStringsIterator(inputs ...string) TagIterator
MustNewTagStringsIterator returns a TagIterator over a slice of strings, panic'ing if it encounters an error.
func NewTagStringsIterator ¶
func NewTagStringsIterator(inputs ...string) (TagIterator, error)
NewTagStringsIterator returns a TagIterator over a slice of strings.
type TagMatcher ¶
TagMatcher is a gomock.Matcher that matches Tag
func NewTagMatcher ¶
func NewTagMatcher(name string, value string) TagMatcher
NewTagMatcher returns a new TagMatcher
type Tags ¶
type Tags struct {
// contains filtered or unexported fields
}
Tags is a collection of Tag instances that can be pooled.
func (Tags) Equal ¶
Equal returns a bool indicating if the tags are equal. It requires the two slices are ordered the same.
func (*Tags) Finalize ¶
func (t *Tags) Finalize()
Finalize finalizes all Tags, unless NoFinalize has been called previously in which case this is a no-op.
func (*Tags) NoFinalize ¶
func (t *Tags) NoFinalize()
NoFinalize makes calls to finalize a no-op, this is useful when you would like to share a type with another sub-system that should is not allowed to finalize the resource as the resource is kept indefinitely until garbage collected (i.e. longly lived).
type TagsIterator ¶
type TagsIterator interface { TagIterator // Reset allows the tag iterator to be reused with a new set of tags. Reset(tags Tags) }
TagsIterator represents a TagIterator that can be reset with a Tags collection type. It is not thread-safe.
func NewTagsIterator ¶
func NewTagsIterator(tags Tags) TagsIterator
NewTagsIterator returns a TagsIterator over a set of tags.