internal

package
v1.6.1-exp-2-tr Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizerMock added in v1.4.3

type AuthorizerMock struct {
	AuthorizeDatabaseFn    func(influxql.Privilege, string) bool
	AuthorizeQueryFn       func(database string, query *influxql.Query) error
	AuthorizeSeriesReadFn  func(database string, measurement []byte, tags models.Tags) bool
	AuthorizeSeriesWriteFn func(database string, measurement []byte, tags models.Tags) bool
}

AuthorizerMock is a mockable implementation of a query.Authorizer.

func (*AuthorizerMock) AuthorizeDatabase added in v1.4.3

func (a *AuthorizerMock) AuthorizeDatabase(p influxql.Privilege, name string) bool

AuthorizeDatabase determines if the provided privilege is sufficient to authorise access to the database.

func (*AuthorizerMock) AuthorizeQuery added in v1.4.3

func (a *AuthorizerMock) AuthorizeQuery(database string, query *influxql.Query) error

AuthorizeQuery determins if the query can be executed against the provided database.

func (*AuthorizerMock) AuthorizeSeriesRead added in v1.4.3

func (a *AuthorizerMock) AuthorizeSeriesRead(database string, measurement []byte, tags models.Tags) bool

AuthorizeSeriesRead determines if the series comprising measurement and tags can be read on the provided database.

func (*AuthorizerMock) AuthorizeSeriesWrite added in v1.4.3

func (a *AuthorizerMock) AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool

AuthorizeSeriesWrite determines if the series comprising measurement and tags can be written to, on the provided database.

type BatchCursorMock added in v1.6.0

type BatchCursorMock struct {
	CloseFn func()
	ErrFn   func() error
}

BatchCursorMock provides a mock base implementation for batch cursors.

func NewBatchCursorMock added in v1.6.0

func NewBatchCursorMock() *BatchCursorMock

NewBatchCursorMock returns an initialised BatchCursorMock, which returns the zero value for all methods.

func (*BatchCursorMock) Close added in v1.6.0

func (c *BatchCursorMock) Close()

Close closes the cursor.

func (*BatchCursorMock) Err added in v1.6.0

func (c *BatchCursorMock) Err() error

Err returns the latest error, if any.

type BooleanBatchCursorMock added in v1.6.0

type BooleanBatchCursorMock struct {
	*BatchCursorMock
	NextFn func() (keys []int64, values []bool)
}

BooleanBatchCursorMock provides a mock implementation of a BooleanBatchCursor.

func NewBooleanBatchCursorMock added in v1.6.0

func NewBooleanBatchCursorMock() *BooleanBatchCursorMock

NewBooleanBatchCursorMock returns an initialised BooleanBatchCursorMock, which returns the zero value for all methods.

func (*BooleanBatchCursorMock) Next added in v1.6.0

func (c *BooleanBatchCursorMock) Next() (keys []int64, values []bool)

Next returns the next set of keys and values.

type FloatBatchCursorMock added in v1.6.0

type FloatBatchCursorMock struct {
	*BatchCursorMock
	NextFn func() (keys []int64, values []float64)
}

FloatBatchCursorMock provides a mock implementation of a FloatBatchCursor.

func NewFloatBatchCursorMock added in v1.6.0

func NewFloatBatchCursorMock() *FloatBatchCursorMock

NewFloatBatchCursorMock returns an initialised FloatBatchCursorMock, which returns the zero value for all methods.

func (*FloatBatchCursorMock) Next added in v1.6.0

func (c *FloatBatchCursorMock) Next() (keys []int64, values []float64)

Next returns the next set of keys and values.

type IntegerBatchCursorMock added in v1.6.0

type IntegerBatchCursorMock struct {
	*BatchCursorMock
	NextFn func() (keys []int64, values []int64)
}

IntegerBatchCursorMock provides a mock implementation of an IntegerBatchCursorMock.

func NewIntegerBatchCursorMock added in v1.6.0

func NewIntegerBatchCursorMock() *IntegerBatchCursorMock

NewIntegerBatchCursorMock returns an initialised IntegerBatchCursorMock, which returns the zero value for all methods.

func (*IntegerBatchCursorMock) Next added in v1.6.0

func (c *IntegerBatchCursorMock) Next() (keys []int64, values []int64)

Next returns the next set of keys and values.

type MetaClientMock

type MetaClientMock struct {
	CloseFn                             func() error
	CreateContinuousQueryFn             func(database, name, query string) error
	CreateDatabaseFn                    func(name string) (*meta.DatabaseInfo, error)
	CreateDatabaseWithRetentionPolicyFn func(name string, spec *meta.RetentionPolicySpec) (*meta.DatabaseInfo, error)
	CreateRetentionPolicyFn             func(database string, spec *meta.RetentionPolicySpec, makeDefault bool) (*meta.RetentionPolicyInfo, error)
	CreateShardGroupFn                  func(database, policy string, timestamp time.Time) (*meta.ShardGroupInfo, error)
	CreateSubscriptionFn                func(database, rp, name, mode string, destinations []string) error
	CreateUserFn                        func(name, password string, admin bool) (meta.User, error)

	DatabaseFn  func(name string) *meta.DatabaseInfo
	DatabasesFn func() []meta.DatabaseInfo

	DataFn                func() meta.Data
	DeleteShardGroupFn    func(database string, policy string, id uint64) error
	DropContinuousQueryFn func(database, name string) error
	DropDatabaseFn        func(name string) error
	DropRetentionPolicyFn func(database, name string) error
	DropSubscriptionFn    func(database, rp, name string) error
	DropShardFn           func(id uint64) error
	DropUserFn            func(name string) error

	OpenFn func() error

	PrecreateShardGroupsFn func(from, to time.Time) error
	PruneShardGroupsFn     func() error

	RetentionPolicyFn func(database, name string) (rpi *meta.RetentionPolicyInfo, err error)

	AuthenticateFn           func(username, password string) (ui meta.User, err error)
	AdminUserExistsFn        func() bool
	SetAdminPrivilegeFn      func(username string, admin bool) error
	SetDataFn                func(*meta.Data) error
	SetPrivilegeFn           func(username, database string, p influxql.Privilege) error
	ShardGroupsByTimeRangeFn func(database, policy string, min, max time.Time) (a []meta.ShardGroupInfo, err error)
	ShardOwnerFn             func(shardID uint64) (database, policy string, sgi *meta.ShardGroupInfo)
	TruncateShardGroupsFn    func(t time.Time) error
	UpdateRetentionPolicyFn  func(database, name string, rpu *meta.RetentionPolicyUpdate, makeDefault bool) error
	UpdateUserFn             func(name, password string) error
	UserPrivilegeFn          func(username, database string) (*influxql.Privilege, error)
	UserPrivilegesFn         func(username string) (map[string]influxql.Privilege, error)
	UserFn                   func(username string) (meta.User, error)
	UsersFn                  func() []meta.UserInfo
}

MetaClientMock is a mockable implementation of meta.MetaClient.

func (*MetaClientMock) AdminUserExists added in v1.3.0

func (c *MetaClientMock) AdminUserExists() bool

func (*MetaClientMock) Authenticate added in v1.3.0

func (c *MetaClientMock) Authenticate(username, password string) (meta.User, error)

func (*MetaClientMock) Close

func (c *MetaClientMock) Close() error

func (*MetaClientMock) CreateContinuousQuery

func (c *MetaClientMock) CreateContinuousQuery(database, name, query string) error

func (*MetaClientMock) CreateDatabase

func (c *MetaClientMock) CreateDatabase(name string) (*meta.DatabaseInfo, error)

func (*MetaClientMock) CreateDatabaseWithRetentionPolicy

func (c *MetaClientMock) CreateDatabaseWithRetentionPolicy(name string, spec *meta.RetentionPolicySpec) (*meta.DatabaseInfo, error)

func (*MetaClientMock) CreateRetentionPolicy

func (c *MetaClientMock) CreateRetentionPolicy(database string, spec *meta.RetentionPolicySpec, makeDefault bool) (*meta.RetentionPolicyInfo, error)

func (*MetaClientMock) CreateShardGroup

func (c *MetaClientMock) CreateShardGroup(database, policy string, timestamp time.Time) (*meta.ShardGroupInfo, error)

func (*MetaClientMock) CreateSubscription

func (c *MetaClientMock) CreateSubscription(database, rp, name, mode string, destinations []string) error

func (*MetaClientMock) CreateUser

func (c *MetaClientMock) CreateUser(name, password string, admin bool) (meta.User, error)

func (*MetaClientMock) Data

func (c *MetaClientMock) Data() meta.Data

func (*MetaClientMock) Database

func (c *MetaClientMock) Database(name string) *meta.DatabaseInfo

func (*MetaClientMock) Databases

func (c *MetaClientMock) Databases() []meta.DatabaseInfo

func (*MetaClientMock) DeleteShardGroup

func (c *MetaClientMock) DeleteShardGroup(database string, policy string, id uint64) error

func (*MetaClientMock) DropContinuousQuery

func (c *MetaClientMock) DropContinuousQuery(database, name string) error

func (*MetaClientMock) DropDatabase

func (c *MetaClientMock) DropDatabase(name string) error

func (*MetaClientMock) DropRetentionPolicy

func (c *MetaClientMock) DropRetentionPolicy(database, name string) error

func (*MetaClientMock) DropShard

func (c *MetaClientMock) DropShard(id uint64) error

func (*MetaClientMock) DropSubscription

func (c *MetaClientMock) DropSubscription(database, rp, name string) error

func (*MetaClientMock) DropUser

func (c *MetaClientMock) DropUser(name string) error

func (*MetaClientMock) Open

func (c *MetaClientMock) Open() error

func (*MetaClientMock) PrecreateShardGroups added in v1.5.0

func (c *MetaClientMock) PrecreateShardGroups(from, to time.Time) error

func (*MetaClientMock) PruneShardGroups added in v1.4.0

func (c *MetaClientMock) PruneShardGroups() error

func (*MetaClientMock) RetentionPolicy

func (c *MetaClientMock) RetentionPolicy(database, name string) (rpi *meta.RetentionPolicyInfo, err error)

func (*MetaClientMock) SetAdminPrivilege

func (c *MetaClientMock) SetAdminPrivilege(username string, admin bool) error

func (*MetaClientMock) SetData

func (c *MetaClientMock) SetData(d *meta.Data) error

func (*MetaClientMock) SetPrivilege

func (c *MetaClientMock) SetPrivilege(username, database string, p influxql.Privilege) error

func (*MetaClientMock) ShardGroupsByTimeRange added in v1.2.0

func (c *MetaClientMock) ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []meta.ShardGroupInfo, err error)

func (*MetaClientMock) ShardOwner

func (c *MetaClientMock) ShardOwner(shardID uint64) (database, policy string, sgi *meta.ShardGroupInfo)

func (*MetaClientMock) TruncateShardGroups added in v1.5.0

func (c *MetaClientMock) TruncateShardGroups(t time.Time) error

func (*MetaClientMock) UpdateRetentionPolicy

func (c *MetaClientMock) UpdateRetentionPolicy(database, name string, rpu *meta.RetentionPolicyUpdate, makeDefault bool) error

func (*MetaClientMock) UpdateUser

func (c *MetaClientMock) UpdateUser(name, password string) error

func (*MetaClientMock) User added in v1.3.0

func (c *MetaClientMock) User(username string) (meta.User, error)

func (*MetaClientMock) UserPrivilege

func (c *MetaClientMock) UserPrivilege(username, database string) (*influxql.Privilege, error)

func (*MetaClientMock) UserPrivileges

func (c *MetaClientMock) UserPrivileges(username string) (map[string]influxql.Privilege, error)

func (*MetaClientMock) Users

func (c *MetaClientMock) Users() []meta.UserInfo

type StorageResultsMock added in v1.6.0

type StorageResultsMock struct {
	CloseFn  func()
	NextFn   func() bool
	CursorFn func() tsdb.Cursor
	TagsFn   func() models.Tags
}

StorageResultsMock implements the storage.Results interface providing the ability to emit mock results from calls to the StorageStoreMock.Read method.

func NewStorageResultsMock added in v1.6.0

func NewStorageResultsMock() *StorageResultsMock

NewStorageResultsMock initialises a StorageResultsMock whose methods all return their zero value.

func (*StorageResultsMock) Close added in v1.6.0

func (r *StorageResultsMock) Close()

Close closes the result set.

func (*StorageResultsMock) Cursor added in v1.6.0

func (r *StorageResultsMock) Cursor() tsdb.Cursor

Cursor returns the cursor for the result set.

func (*StorageResultsMock) Next added in v1.6.0

func (r *StorageResultsMock) Next() bool

Next returns true if there are more results available.

func (*StorageResultsMock) Tags added in v1.6.0

func (r *StorageResultsMock) Tags() models.Tags

Tags returns the series' tag set.

type StorageStoreMock added in v1.6.0

type StorageStoreMock struct {
	ReadFn       func(ctx context.Context, req *storage.ReadRequest) (storage.Results, error)
	WithLoggerFn func(log *zap.Logger)

	ResultSet *StorageResultsMock
}

TSDBStoreMock is a mockable implementation of storage.Store.

It's currently a partial implementation as one of a store's exported methods returns an unexported type.

func NewStorageStoreMock added in v1.6.0

func NewStorageStoreMock() *StorageStoreMock

NewStorageStoreMock initialises a StorageStoreMock with methods that return their zero values. It also initialises a StorageResultsMock, which can be configured via the ResultSet field.

func (*StorageStoreMock) Read added in v1.6.0

Read reads the storage request and returns a cursor to access results.

func (*StorageStoreMock) WithLogger added in v1.6.0

func (s *StorageStoreMock) WithLogger(log *zap.Logger)

WithLogger sets the logger.

type StringBatchCursorMock added in v1.6.0

type StringBatchCursorMock struct {
	*BatchCursorMock
	NextFn func() (keys []int64, values []string)
}

StringBatchCursorMock provides a mock implementation of a StringBatchCursor.

func NewStringBatchCursorMock added in v1.6.0

func NewStringBatchCursorMock() *StringBatchCursorMock

NewStringBatchCursorMock returns an initialised StringBatchCursorMock, which returns the zero value for all methods.

func (*StringBatchCursorMock) Next added in v1.6.0

func (c *StringBatchCursorMock) Next() (keys []int64, values []string)

Next returns the next set of keys and values.

type TSDBStoreMock added in v1.4.0

type TSDBStoreMock struct {
	BackupShardFn             func(id uint64, since time.Time, w io.Writer) error
	BackupSeriesFileFn        func(database string, w io.Writer) error
	ExportShardFn             func(id uint64, ExportStart time.Time, ExportEnd time.Time, w io.Writer) error
	CloseFn                   func() error
	CreateShardFn             func(database, policy string, shardID uint64, enabled bool) error
	CreateShardSnapshotFn     func(id uint64) (string, error)
	DatabasesFn               func() []string
	DeleteDatabaseFn          func(name string) error
	DeleteMeasurementFn       func(database, name string) error
	DeleteRetentionPolicyFn   func(database, name string) error
	DeleteSeriesFn            func(database string, sources []influxql.Source, condition influxql.Expr) error
	DeleteShardFn             func(id uint64) error
	DiskSizeFn                func() (int64, error)
	ExpandSourcesFn           func(sources influxql.Sources) (influxql.Sources, error)
	ImportShardFn             func(id uint64, r io.Reader) error
	MeasurementSeriesCountsFn func(database string) (measuments int, series int)
	MeasurementsCardinalityFn func(database string) (int64, error)
	MeasurementNamesFn        func(auth query.Authorizer, database string, cond influxql.Expr) ([][]byte, error)
	OpenFn                    func() error
	PathFn                    func() string
	RestoreShardFn            func(id uint64, r io.Reader) error
	SeriesCardinalityFn       func(database string) (int64, error)
	SetShardEnabledFn         func(shardID uint64, enabled bool) error
	ShardFn                   func(id uint64) *tsdb.Shard
	ShardGroupFn              func(ids []uint64) tsdb.ShardGroup
	ShardIDsFn                func() []uint64
	ShardNFn                  func() int
	ShardRelativePathFn       func(id uint64) (string, error)
	ShardsFn                  func(ids []uint64) []*tsdb.Shard
	StatisticsFn              func(tags map[string]string) []models.Statistic
	TagKeysFn                 func(auth query.Authorizer, shardIDs []uint64, cond influxql.Expr) ([]tsdb.TagKeys, error)
	TagValuesFn               func(auth query.Authorizer, shardIDs []uint64, cond influxql.Expr) ([]tsdb.TagValues, error)
	WithLoggerFn              func(log *zap.Logger)
	WriteToShardFn            func(shardID uint64, points []models.Point) error
}

TSDBStoreMock is a mockable implementation of tsdb.Store.

func (*TSDBStoreMock) BackupSeriesFile added in v1.5.0

func (s *TSDBStoreMock) BackupSeriesFile(database string, w io.Writer) error

func (*TSDBStoreMock) BackupShard added in v1.4.0

func (s *TSDBStoreMock) BackupShard(id uint64, since time.Time, w io.Writer) error

func (*TSDBStoreMock) Close added in v1.4.0

func (s *TSDBStoreMock) Close() error

func (*TSDBStoreMock) CreateShard added in v1.4.0

func (s *TSDBStoreMock) CreateShard(database string, retentionPolicy string, shardID uint64, enabled bool) error

func (*TSDBStoreMock) CreateShardSnapshot added in v1.4.0

func (s *TSDBStoreMock) CreateShardSnapshot(id uint64) (string, error)

func (*TSDBStoreMock) Databases added in v1.4.0

func (s *TSDBStoreMock) Databases() []string

func (*TSDBStoreMock) DeleteDatabase added in v1.4.0

func (s *TSDBStoreMock) DeleteDatabase(name string) error

func (*TSDBStoreMock) DeleteMeasurement added in v1.4.0

func (s *TSDBStoreMock) DeleteMeasurement(database string, name string) error

func (*TSDBStoreMock) DeleteRetentionPolicy added in v1.4.0

func (s *TSDBStoreMock) DeleteRetentionPolicy(database string, name string) error

func (*TSDBStoreMock) DeleteSeries added in v1.4.0

func (s *TSDBStoreMock) DeleteSeries(database string, sources []influxql.Source, condition influxql.Expr) error

func (*TSDBStoreMock) DeleteShard added in v1.4.0

func (s *TSDBStoreMock) DeleteShard(shardID uint64) error

func (*TSDBStoreMock) DiskSize added in v1.4.0

func (s *TSDBStoreMock) DiskSize() (int64, error)

func (*TSDBStoreMock) ExpandSources added in v1.4.0

func (s *TSDBStoreMock) ExpandSources(sources influxql.Sources) (influxql.Sources, error)

func (*TSDBStoreMock) ExportShard added in v1.5.0

func (s *TSDBStoreMock) ExportShard(id uint64, ExportStart time.Time, ExportEnd time.Time, w io.Writer) error

func (*TSDBStoreMock) ImportShard added in v1.4.0

func (s *TSDBStoreMock) ImportShard(id uint64, r io.Reader) error

func (*TSDBStoreMock) MeasurementNames added in v1.4.0

func (s *TSDBStoreMock) MeasurementNames(auth query.Authorizer, database string, cond influxql.Expr) ([][]byte, error)

func (*TSDBStoreMock) MeasurementSeriesCounts added in v1.4.0

func (s *TSDBStoreMock) MeasurementSeriesCounts(database string) (measuments int, series int)

func (*TSDBStoreMock) MeasurementsCardinality added in v1.4.0

func (s *TSDBStoreMock) MeasurementsCardinality(database string) (int64, error)

func (*TSDBStoreMock) Open added in v1.4.0

func (s *TSDBStoreMock) Open() error

func (*TSDBStoreMock) Path added in v1.4.0

func (s *TSDBStoreMock) Path() string

func (*TSDBStoreMock) RestoreShard added in v1.4.0

func (s *TSDBStoreMock) RestoreShard(id uint64, r io.Reader) error

func (*TSDBStoreMock) SeriesCardinality added in v1.4.0

func (s *TSDBStoreMock) SeriesCardinality(database string) (int64, error)

func (*TSDBStoreMock) SetShardEnabled added in v1.4.0

func (s *TSDBStoreMock) SetShardEnabled(shardID uint64, enabled bool) error

func (*TSDBStoreMock) Shard added in v1.4.0

func (s *TSDBStoreMock) Shard(id uint64) *tsdb.Shard

func (*TSDBStoreMock) ShardGroup added in v1.4.0

func (s *TSDBStoreMock) ShardGroup(ids []uint64) tsdb.ShardGroup

func (*TSDBStoreMock) ShardIDs added in v1.4.0

func (s *TSDBStoreMock) ShardIDs() []uint64

func (*TSDBStoreMock) ShardN added in v1.4.0

func (s *TSDBStoreMock) ShardN() int

func (*TSDBStoreMock) ShardRelativePath added in v1.4.0

func (s *TSDBStoreMock) ShardRelativePath(id uint64) (string, error)

func (*TSDBStoreMock) Shards added in v1.4.0

func (s *TSDBStoreMock) Shards(ids []uint64) []*tsdb.Shard

func (*TSDBStoreMock) Statistics added in v1.4.0

func (s *TSDBStoreMock) Statistics(tags map[string]string) []models.Statistic

func (*TSDBStoreMock) TagKeys added in v1.4.0

func (s *TSDBStoreMock) TagKeys(auth query.Authorizer, shardIDs []uint64, cond influxql.Expr) ([]tsdb.TagKeys, error)

func (*TSDBStoreMock) TagValues added in v1.4.0

func (s *TSDBStoreMock) TagValues(auth query.Authorizer, shardIDs []uint64, cond influxql.Expr) ([]tsdb.TagValues, error)

func (*TSDBStoreMock) WithLogger added in v1.4.0

func (s *TSDBStoreMock) WithLogger(log *zap.Logger)

func (*TSDBStoreMock) WriteToShard added in v1.4.0

func (s *TSDBStoreMock) WriteToShard(shardID uint64, points []models.Point) error

type UnsignedBatchCursorMock added in v1.6.0

type UnsignedBatchCursorMock struct {
	*BatchCursorMock
	NextFn func() (keys []int64, values []uint64)
}

UnsignedBatchCursorMock provides a mock implementation of an UnsignedBatchCursorMock.

func NewUnsignedBatchCursorMock added in v1.6.0

func NewUnsignedBatchCursorMock() *UnsignedBatchCursorMock

NewUnsignedBatchCursorMock returns an initialised UnsignedBatchCursorMock, which returns the zero value for all methods.

func (*UnsignedBatchCursorMock) Next added in v1.6.0

func (c *UnsignedBatchCursorMock) Next() (keys []int64, values []uint64)

Next returns the next set of keys and values.

Jump to

Keyboard shortcuts

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