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 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) DeleteChunk(ctx context.Context, userID, chunkID string) error
- func (m *MockStorage) DeleteObject(ctx context.Context, objectKey string) 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) GetChunks(ctx context.Context, chunkSet []chunk.Chunk) ([]chunk.Chunk, error)
- func (m *MockStorage) GetObject(ctx context.Context, objectKey string) (io.ReadCloser, int64, error)
- func (m *MockStorage) GetObjectCount() int
- func (m *MockStorage) GetSortedObjectKeys() []string
- func (m *MockStorage) IsChunkNotFoundErr(err error) bool
- func (m *MockStorage) IsObjectNotFoundErr(err error) bool
- func (m *MockStorage) List(ctx context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)
- func (m *MockStorage) ListTables(_ context.Context) ([]string, error)
- func (m *MockStorage) NewWriteBatch() index.WriteBatch
- func (m *MockStorage) PutChunks(_ context.Context, chunks []chunk.Chunk) error
- func (m *MockStorage) PutObject(ctx context.Context, objectKey string, object io.ReadSeeker) error
- 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 ¶
View Source
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 MockStorage ¶
type MockStorage struct {
// contains filtered or unexported fields
}
MockStorage is a fake in-memory StorageClient.
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) DeleteChunk ¶
func (m *MockStorage) DeleteChunk(ctx context.Context, userID, chunkID string) error
DeleteChunk implements StorageClient.
func (*MockStorage) DeleteObject ¶
func (m *MockStorage) DeleteObject(ctx context.Context, objectKey string) error
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) GetObject ¶
func (m *MockStorage) GetObject(ctx context.Context, objectKey string) (io.ReadCloser, int64, error)
func (*MockStorage) GetObjectCount ¶
func (m *MockStorage) GetObjectCount() int
func (*MockStorage) GetSortedObjectKeys ¶
func (m *MockStorage) GetSortedObjectKeys() []string
func (*MockStorage) IsChunkNotFoundErr ¶
func (m *MockStorage) IsChunkNotFoundErr(err error) bool
func (*MockStorage) IsObjectNotFoundErr ¶
func (m *MockStorage) IsObjectNotFoundErr(err error) bool
func (*MockStorage) List ¶
func (m *MockStorage) List(ctx context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)
List implements chunk.ObjectClient.
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) PutObject ¶
func (m *MockStorage) PutObject(ctx context.Context, objectKey string, object io.ReadSeeker) error
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
Click to show internal directories.
Click to hide internal directories.