Documentation ¶
Index ¶
- Constants
- func CreateChunks(scfg config.SchemaConfig, startIndex, batchSize int, from model.Time, ...) ([]string, []chunk.Chunk, error)
- func DefaultSchemaConfig(kind string) config.SchemaConfig
- func DummyChunkFor(from, through model.Time, metric labels.Labels) chunk.Chunk
- func ResetMockStorage()
- func SchemaConfig(store, schema string, from model.Time) config.SchemaConfig
- func Setup(fixture Fixture, tableName string) (index.Client, chunkclient.Client, io.Closer, error)
- type CloserFunc
- type Fixture
- type InMemoryObjectClient
- func (m *InMemoryObjectClient) DeleteObject(_ context.Context, objectKey string) error
- func (m *InMemoryObjectClient) GetObject(_ context.Context, objectKey string) (io.ReadCloser, int64, error)
- func (m *InMemoryObjectClient) GetObjectRange(_ context.Context, objectKey string, offset, length int64) (io.ReadCloser, error)
- func (m *InMemoryObjectClient) Internals() map[string][]byte
- func (m *InMemoryObjectClient) IsObjectNotFoundErr(err error) bool
- func (m *InMemoryObjectClient) IsRetryableErr(error) bool
- func (m *InMemoryObjectClient) List(_ context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)
- func (m *InMemoryObjectClient) ObjectExists(_ context.Context, objectKey string) (bool, error)
- func (m *InMemoryObjectClient) PutObject(_ context.Context, objectKey string, object io.Reader) error
- func (*InMemoryObjectClient) Stop()
- type MockStorage
- func (m *MockStorage) BatchWrite(ctx context.Context, batch index.WriteBatch) error
- func (m *MockStorage) CreateTable(_ context.Context, desc config.TableDesc) error
- func (m *MockStorage) DeleteTable(_ context.Context, name string) error
- func (m *MockStorage) DescribeTable(_ context.Context, name string) (desc config.TableDesc, isActive bool, err error)
- func (m *MockStorage) GetObjectCount() int
- func (m *MockStorage) GetSchemaConfigs() []config.PeriodConfig
- func (m *MockStorage) GetSortedObjectKeys() []string
- func (m *MockStorage) IsChunkNotFoundErr(err error) bool
- func (m *MockStorage) ListTables(_ context.Context) ([]string, error)
- func (m *MockStorage) NewWriteBatch() index.WriteBatch
- func (m *MockStorage) QueryPages(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error
- func (m *MockStorage) SetMode(mode MockStorageMode)
- func (*MockStorage) Stop()
- func (m *MockStorage) UpdateTable(_ context.Context, _, desc config.TableDesc) error
- type MockStorageMode
Constants ¶
const ( MockStorageModeReadWrite = 0 MockStorageModeReadOnly = 1 MockStorageModeWriteOnly = 2 )
Variables ¶
This section is empty.
Functions ¶
func CreateChunks ¶
func CreateChunks(scfg config.SchemaConfig, startIndex, batchSize int, from model.Time, through model.Time) ([]string, []chunk.Chunk, error)
CreateChunks creates some chunks for testing
func DefaultSchemaConfig ¶
func DefaultSchemaConfig(kind string) config.SchemaConfig
DefaultSchemaConfig returns default schema for use in test fixtures
func ResetMockStorage ¶
func ResetMockStorage()
func SchemaConfig ¶
func SchemaConfig(store, schema string, from model.Time) config.SchemaConfig
Types ¶
type CloserFunc ¶
type CloserFunc func() error
CloserFunc is to io.Closer as http.HandlerFunc is to http.Handler.
type Fixture ¶
type Fixture interface { Name() string Clients() (index.Client, chunkclient.Client, index.TableClient, config.SchemaConfig, io.Closer, error) }
Fixture type for per-backend testing.
type InMemoryObjectClient ¶
type InMemoryObjectClient struct {
// contains filtered or unexported fields
}
func NewInMemoryObjectClient ¶
func NewInMemoryObjectClient() *InMemoryObjectClient
func (*InMemoryObjectClient) DeleteObject ¶
func (m *InMemoryObjectClient) DeleteObject(_ context.Context, objectKey string) error
DeleteObject implements client.ObjectClient.
func (*InMemoryObjectClient) GetObject ¶
func (m *InMemoryObjectClient) GetObject(_ context.Context, objectKey string) (io.ReadCloser, int64, error)
GetObject implements client.ObjectClient.
func (*InMemoryObjectClient) GetObjectRange ¶ added in v3.2.0
func (m *InMemoryObjectClient) GetObjectRange(_ context.Context, objectKey string, offset, length int64) (io.ReadCloser, error)
GetObject implements client.ObjectClient.
func (*InMemoryObjectClient) Internals ¶
func (m *InMemoryObjectClient) Internals() map[string][]byte
func (*InMemoryObjectClient) IsObjectNotFoundErr ¶
func (m *InMemoryObjectClient) IsObjectNotFoundErr(err error) bool
IsObjectNotFoundErr implements client.ObjectClient.
func (*InMemoryObjectClient) IsRetryableErr ¶
func (m *InMemoryObjectClient) IsRetryableErr(error) bool
IsRetryableErr implements client.ObjectClient.
func (*InMemoryObjectClient) List ¶
func (m *InMemoryObjectClient) List(_ context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)
List implements chunk.ObjectClient.
func (*InMemoryObjectClient) ObjectExists ¶
ObjectExists implments client.ObjectClient
func (*InMemoryObjectClient) PutObject ¶
func (m *InMemoryObjectClient) PutObject(_ context.Context, objectKey string, object io.Reader) error
PutObject implements client.ObjectClient.
func (*InMemoryObjectClient) Stop ¶
func (*InMemoryObjectClient) Stop()
Stop implements client.ObjectClient
type MockStorage ¶
type MockStorage struct { *InMemoryObjectClient // contains filtered or unexported fields }
MockStorage is a fake in-memory StorageClient.
func NewMockStorage ¶
func NewMockStorage() *MockStorage
NewMockStorage creates a mock storage singleton MockStorage implements the interfaces client.ObjectClient, index.Client, index.TableClient, and storage.SchemaConfigProvider
func (*MockStorage) BatchWrite ¶
func (m *MockStorage) BatchWrite(ctx context.Context, batch index.WriteBatch) error
BatchWrite implements StorageClient.
func (*MockStorage) CreateTable ¶
CreateTable implements StorageClient.
func (*MockStorage) DeleteTable ¶
func (m *MockStorage) DeleteTable(_ context.Context, name string) error
DeleteTable implements StorageClient.
func (*MockStorage) DescribeTable ¶
func (m *MockStorage) DescribeTable(_ context.Context, name string) (desc config.TableDesc, isActive bool, err error)
DescribeTable implements StorageClient.
func (*MockStorage) GetObjectCount ¶
func (m *MockStorage) GetObjectCount() int
func (*MockStorage) GetSchemaConfigs ¶
func (m *MockStorage) GetSchemaConfigs() []config.PeriodConfig
func (*MockStorage) GetSortedObjectKeys ¶
func (m *MockStorage) GetSortedObjectKeys() []string
func (*MockStorage) IsChunkNotFoundErr ¶
func (m *MockStorage) IsChunkNotFoundErr(err error) bool
func (*MockStorage) ListTables ¶
func (m *MockStorage) ListTables(_ context.Context) ([]string, error)
ListTables implements StorageClient.
func (*MockStorage) NewWriteBatch ¶
func (m *MockStorage) NewWriteBatch() index.WriteBatch
NewWriteBatch implements StorageClient.
func (*MockStorage) QueryPages ¶
func (m *MockStorage) QueryPages(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error
QueryPages implements StorageClient.
func (*MockStorage) SetMode ¶
func (m *MockStorage) SetMode(mode MockStorageMode)
func (*MockStorage) UpdateTable ¶
UpdateTable implements StorageClient.
type MockStorageMode ¶
type MockStorageMode int