document

package
v0.0.0-...-ad801e6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReturnArrayToPool

func ReturnArrayToPool(docs []Document, p *BucketizedDocumentArrayPool)

ReturnArrayToPool returns a document array to pool.

Types

type BucketizedDocumentArrayPool

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

BucketizedDocumentArrayPool is a bucketized value pool.

func NewBucketizedDocumentArrayPool

func NewBucketizedDocumentArrayPool(sizes []DocumentArrayBucket, opts *DocumentArrayPoolOptions) *BucketizedDocumentArrayPool

NewBucketizedDocumentArrayPool creates a bucketized object pool.

func (*BucketizedDocumentArrayPool) Get

func (p *BucketizedDocumentArrayPool) Get(capacity int) []Document

Get gets a value from the pool.

func (*BucketizedDocumentArrayPool) Init

func (p *BucketizedDocumentArrayPool) Init(alloc func(capacity int) []Document)

Init initializes the bucketized pool.

func (*BucketizedDocumentArrayPool) Put

func (p *BucketizedDocumentArrayPool) Put(v []Document, capacity int)

Put puts a value to the pool.

type BucketizedDocumentArrayPoolConfiguration

type BucketizedDocumentArrayPoolConfiguration struct {
	// The pool bucket configuration.
	Buckets []DocumentArrayBucketConfiguration `yaml:"buckets"`

	// The watermark configuration.
	Watermark DocumentArrayPoolWatermarkConfiguration `yaml:"watermark"`
}

BucketizedDocumentArrayPoolConfiguration contains configuration for bucketized pools.

func (*BucketizedDocumentArrayPoolConfiguration) NewBuckets

NewBuckets create a new list of buckets.

func (*BucketizedDocumentArrayPoolConfiguration) NewPoolOptions

NewPoolOptions creates a new set of pool options.

type Document

type Document struct {
	ID             []byte
	TimeNanos      int64
	RawData        []byte
	Fields         field.Fields
	FieldArrayPool *field.BucketizedFieldArrayPool
}

Document is a discrete, timestamped document.

func (*Document) Reset

func (d *Document) Reset()

Reset resets a document.

func (*Document) ToProto

func (d *Document) ToProto() (servicepb.Document, error)

ToProto converts a document to a document proto message.

type DocumentArrayBucket

type DocumentArrayBucket struct {
	// Capacity is the size of each element in the bucket.
	Capacity int

	// Count is the number of fixed elements in the bucket.
	Count int

	// Options is an optional override to specify options to use for a bucket,
	// specify nil to use the options specified to the bucketized pool
	// constructor for this bucket.
	Options *DocumentArrayPoolOptions
}

DocumentArrayBucket specifies a bucket.

type DocumentArrayBucketConfiguration

type DocumentArrayBucketConfiguration struct {
	// The count of the items in the bucket.
	Count int `yaml:"count"`

	// The capacity of each item in the bucket.
	Capacity int `yaml:"capacity"`
}

DocumentArrayBucketConfiguration contains configuration for a pool bucket.

func (*DocumentArrayBucketConfiguration) NewBucket

NewBucket creates a new bucket.

type DocumentArrayPool

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

DocumentArrayPool is a value pool.

func NewDocumentArrayPool

func NewDocumentArrayPool(opts *DocumentArrayPoolOptions) *DocumentArrayPool

NewDocumentArrayPool creates a new pool.

func (*DocumentArrayPool) Get

func (p *DocumentArrayPool) Get() []Document

Get gets a value from the pool.

func (*DocumentArrayPool) Init

func (p *DocumentArrayPool) Init(alloc func() []Document)

Init initializes the pool.

func (*DocumentArrayPool) Put

func (p *DocumentArrayPool) Put(v []Document)

Put returns a value to pool.

type DocumentArrayPoolConfiguration

type DocumentArrayPoolConfiguration struct {
	// The size of the pool.
	Size *int `yaml:"size"`

	// The watermark configuration.
	Watermark DocumentArrayPoolWatermarkConfiguration `yaml:"watermark"`
}

DocumentArrayPoolConfiguration contains pool configuration.

func (*DocumentArrayPoolConfiguration) NewPoolOptions

func (c *DocumentArrayPoolConfiguration) NewPoolOptions(
	instrumentOpts instrument.Options,
) *DocumentArrayPoolOptions

NewPoolOptions creates a new set of pool options.

type DocumentArrayPoolOptions

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

DocumentArrayPoolOptions provide a set of options for the value pool.

func NewDocumentArrayPoolOptions

func NewDocumentArrayPoolOptions() *DocumentArrayPoolOptions

NewDocumentArrayPoolOptions create a new set of value pool options.

func (*DocumentArrayPoolOptions) InstrumentOptions

func (o *DocumentArrayPoolOptions) InstrumentOptions() instrument.Options

InstrumentOptions returns the instrument options.

func (*DocumentArrayPoolOptions) RefillHighWatermark

func (o *DocumentArrayPoolOptions) RefillHighWatermark() float64

RefillHighWatermark returns the high watermark for stop refilling the pool.

func (*DocumentArrayPoolOptions) RefillLowWatermark

func (o *DocumentArrayPoolOptions) RefillLowWatermark() float64

RefillLowWatermark returns the low watermark for refilling the pool.

func (*DocumentArrayPoolOptions) SetInstrumentOptions

SetInstrumentOptions sets the instrument options.

func (*DocumentArrayPoolOptions) SetRefillHighWatermark

func (o *DocumentArrayPoolOptions) SetRefillHighWatermark(v float64) *DocumentArrayPoolOptions

SetRefillHighWatermark sets the high watermark for refilling the pool.

func (*DocumentArrayPoolOptions) SetRefillLowWatermark

func (o *DocumentArrayPoolOptions) SetRefillLowWatermark(v float64) *DocumentArrayPoolOptions

SetRefillLowWatermark sets the low watermark for refilling the pool.

func (*DocumentArrayPoolOptions) SetSize

SetSize sets the pool size.

func (*DocumentArrayPoolOptions) Size

func (o *DocumentArrayPoolOptions) Size() int

Size returns pool size.

type DocumentArrayPoolWatermarkConfiguration

type DocumentArrayPoolWatermarkConfiguration struct {
	// The low watermark to start refilling the pool, if zero none.
	RefillLowWatermark float64 `yaml:"low" validate:"min=0.0,max=1.0"`

	// The high watermark to stop refilling the pool, if zero none.
	RefillHighWatermark float64 `yaml:"high" validate:"min=0.0,max=1.0"`
}

DocumentArrayPoolWatermarkConfiguration contains watermark configuration for pools.

type Documents

type Documents []Document

Documents is a list of documents.

func (Documents) ToProto

func (docs Documents) ToProto() ([]servicepb.Document, error)

ToProto converts a list of documents to a documents protobuf message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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