Documentation ¶
Index ¶
- func MockObject(data []Chunk) *storagePluginStorageInfo
- type Bucket
- type BucketName
- type Chunk
- type LoopbackHost
- type LoopbackPlugin
- type LoopbackStorage
- type Method
- type ObjectName
- type PluginMockError
- type PluginMockPutObjectResponse
- type TestOption
- type TestOptions
- type TestPluginHostServer
- func (t TestPluginHostServer) ListHosts(ctx context.Context, req *plgpb.ListHostsRequest) (*plgpb.ListHostsResponse, error)
- func (t TestPluginHostServer) NormalizeCatalogData(ctx context.Context, req *plgpb.NormalizeCatalogDataRequest) (*plgpb.NormalizeCatalogDataResponse, error)
- func (t TestPluginHostServer) NormalizeSetData(ctx context.Context, req *plgpb.NormalizeSetDataRequest) (*plgpb.NormalizeSetDataResponse, error)
- func (t TestPluginHostServer) OnCreateCatalog(ctx context.Context, req *plgpb.OnCreateCatalogRequest) (*plgpb.OnCreateCatalogResponse, error)
- func (t TestPluginHostServer) OnCreateSet(ctx context.Context, req *plgpb.OnCreateSetRequest) (*plgpb.OnCreateSetResponse, error)
- func (t TestPluginHostServer) OnDeleteCatalog(ctx context.Context, req *plgpb.OnDeleteCatalogRequest) (*plgpb.OnDeleteCatalogResponse, error)
- func (t TestPluginHostServer) OnDeleteSet(ctx context.Context, req *plgpb.OnDeleteSetRequest) (*plgpb.OnDeleteSetResponse, error)
- func (t TestPluginHostServer) OnUpdateCatalog(ctx context.Context, req *plgpb.OnUpdateCatalogRequest) (*plgpb.OnUpdateCatalogResponse, error)
- func (t TestPluginHostServer) OnUpdateSet(ctx context.Context, req *plgpb.OnUpdateSetRequest) (*plgpb.OnUpdateSetResponse, error)
- type TestPluginServer
- type TestPluginStorageServer
- func (t TestPluginStorageServer) GetObject(req *plgpb.GetObjectRequest, stream plgpb.StoragePluginService_GetObjectServer) error
- func (t TestPluginStorageServer) HeadObject(ctx context.Context, req *plgpb.HeadObjectRequest) (*plgpb.HeadObjectResponse, error)
- func (t TestPluginStorageServer) OnCreateStorageBucket(ctx context.Context, req *plgpb.OnCreateStorageBucketRequest) (*plgpb.OnCreateStorageBucketResponse, error)
- func (t TestPluginStorageServer) OnDeleteStorageBucket(ctx context.Context, req *plgpb.OnDeleteStorageBucketRequest) (*plgpb.OnDeleteStorageBucketResponse, error)
- func (t TestPluginStorageServer) OnUpdateStorageBucket(ctx context.Context, req *plgpb.OnUpdateStorageBucketRequest) (*plgpb.OnUpdateStorageBucketResponse, error)
- func (t TestPluginStorageServer) PutObject(ctx context.Context, req *plgpb.PutObjectRequest) (*plgpb.PutObjectResponse, error)
- func (t TestPluginStorageServer) ValidatePermissions(ctx context.Context, req *plgpb.ValidatePermissionsRequest) (*plgpb.ValidatePermissionsResponse, error)
- type WrappingPluginHostClient
- func (tpc *WrappingPluginHostClient) ListHosts(ctx context.Context, req *plgpb.ListHostsRequest, opts ...grpc.CallOption) (*plgpb.ListHostsResponse, error)
- func (tpc *WrappingPluginHostClient) NormalizeCatalogData(ctx context.Context, req *plgpb.NormalizeCatalogDataRequest, ...) (*plgpb.NormalizeCatalogDataResponse, error)
- func (tpc *WrappingPluginHostClient) NormalizeSetData(ctx context.Context, req *plgpb.NormalizeSetDataRequest, ...) (*plgpb.NormalizeSetDataResponse, error)
- func (tpc *WrappingPluginHostClient) OnCreateCatalog(ctx context.Context, req *plgpb.OnCreateCatalogRequest, ...) (*plgpb.OnCreateCatalogResponse, error)
- func (tpc *WrappingPluginHostClient) OnCreateSet(ctx context.Context, req *plgpb.OnCreateSetRequest, opts ...grpc.CallOption) (*plgpb.OnCreateSetResponse, error)
- func (tpc *WrappingPluginHostClient) OnDeleteCatalog(ctx context.Context, req *plgpb.OnDeleteCatalogRequest, ...) (*plgpb.OnDeleteCatalogResponse, error)
- func (tpc *WrappingPluginHostClient) OnDeleteSet(ctx context.Context, req *plgpb.OnDeleteSetRequest, opts ...grpc.CallOption) (*plgpb.OnDeleteSetResponse, error)
- func (tpc *WrappingPluginHostClient) OnUpdateCatalog(ctx context.Context, req *plgpb.OnUpdateCatalogRequest, ...) (*plgpb.OnUpdateCatalogResponse, error)
- func (tpc *WrappingPluginHostClient) OnUpdateSet(ctx context.Context, req *plgpb.OnUpdateSetRequest, opts ...grpc.CallOption) (*plgpb.OnUpdateSetResponse, error)
- type WrappingPluginStorageClient
- func (tpc *WrappingPluginStorageClient) GetObject(ctx context.Context, req *plgpb.GetObjectRequest, opts ...grpc.CallOption) (plgpb.StoragePluginService_GetObjectClient, error)
- func (tpc *WrappingPluginStorageClient) HeadObject(ctx context.Context, req *plgpb.HeadObjectRequest, opts ...grpc.CallOption) (*plgpb.HeadObjectResponse, error)
- func (tpc *WrappingPluginStorageClient) OnCreateStorageBucket(ctx context.Context, req *plgpb.OnCreateStorageBucketRequest, ...) (*plgpb.OnCreateStorageBucketResponse, error)
- func (tpc *WrappingPluginStorageClient) OnDeleteStorageBucket(ctx context.Context, req *plgpb.OnDeleteStorageBucketRequest, ...) (*plgpb.OnDeleteStorageBucketResponse, error)
- func (tpc *WrappingPluginStorageClient) OnUpdateStorageBucket(ctx context.Context, req *plgpb.OnUpdateStorageBucketRequest, ...) (*plgpb.OnUpdateStorageBucketResponse, error)
- func (tpc *WrappingPluginStorageClient) PutObject(ctx context.Context, req *plgpb.PutObjectRequest, opts ...grpc.CallOption) (*plgpb.PutObjectResponse, error)
- func (tpc *WrappingPluginStorageClient) ValidatePermissions(ctx context.Context, req *plgpb.ValidatePermissionsRequest, ...) (*plgpb.ValidatePermissionsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockObject ¶
func MockObject(data []Chunk) *storagePluginStorageInfo
Types ¶
type Bucket ¶
type Bucket map[ObjectName]*storagePluginStorageInfo
type BucketName ¶
type BucketName string
type LoopbackHost ¶
type LoopbackHost struct {
// contains filtered or unexported fields
}
LoopbackHost provides a host plugin with functionality useful for certain kinds of testing.
It is not (currently) thread-safe.
Over time, if useful, it can be enhanced to do things like handle multiple hosts per set.
type LoopbackPlugin ¶
type LoopbackPlugin struct { *TestPluginServer *LoopbackHost *LoopbackStorage }
LoopbackPlugin provides a host and storage plugin with functionality useful for certain kinds of testing.
It is not (currently) thread-safe.
Over time, if useful, it can be enhanced to do things like handle multiple hosts per set.
func NewLoopbackPlugin ¶
func NewLoopbackPlugin(opt ...TestOption) (*LoopbackPlugin, error)
NewLoopbackPlugin returns a new loopback pluginre For storage service testings NewLoopbackPlugin Supports WithMockErrors and WithMockBuckets as options. If no mock buckets are provided, a bucket named `default` will be created.
type LoopbackStorage ¶
type LoopbackStorage struct {
// contains filtered or unexported fields
}
LoopbackStorage provides a storage plugin with functionality useful for certain kinds of testing.
It is thread-safe.
func (*LoopbackStorage) CloneBucket ¶
func (l *LoopbackStorage) CloneBucket(name string) Bucket
CloneBucket returns a clone of the bucket. returns nil when the bucket is not found.
func (*LoopbackStorage) CloneStorageInfo ¶
func (l *LoopbackStorage) CloneStorageInfo(bucketName, objectName string) *storagePluginStorageInfo
CloneStorageInfo returns a clone of the object stored in memory. Returns nil when the bucket or object is not found.
type Method ¶
type Method uint8
Method is used to determine if an error should be returned to a specific storage plugin method.
const ( // Any will return an error for any of the method defined in the storage plugin. Any Method = iota // Will return an error for the OnCreateStorageBucket method OnCreateStorageBucket // Will return an error for the OnUpdateStorageBucket method OnUpdateStorageBucket // Will return an error for the OnDeleteStorageBucket method OnDeleteStorageBucket // Will return an error for the ValidatePermissions method ValidatePermissions // Will return an error for the HeadObject method HeadObject // Will return an error for the GetObject method GetObject // Will return an error for the PutObject method PutObject )
type ObjectName ¶
type ObjectName string
type PluginMockError ¶
type PluginMockError struct { BucketName string BucketPrefix string ObjectKey string ErrMsg string ErrCode codes.Code ErrMethod Method }
PluginMockError is used to mock an error when interacting with an external object store.
type PluginMockPutObjectResponse ¶
type PluginMockPutObjectResponse struct { BucketName string BucketPrefix string ObjectKey string Response *plgpb.PutObjectResponse }
PluginMockPutObjectResponse is used to mock a response when calling putObject.
type TestOption ¶
type TestOption func(*TestOptions) error
func WithChunkSize ¶
func WithChunkSize(size int) TestOption
WithChunkSize provides an option to set the chunkSize used for grpc streams.
func WithMockBuckets ¶
func WithMockBuckets(buckets map[BucketName]Bucket) TestOption
WithMockBuckets provides an option to create mocked external object store buckets.
func WithMockError ¶
func WithMockError(err PluginMockError) TestOption
WithMockError provides an option to mock an error when interacting with an external object store.
func WithMockPutObjectResponse ¶
func WithMockPutObjectResponse(response PluginMockPutObjectResponse) TestOption
type TestOptions ¶
type TestOptions struct {
// contains filtered or unexported fields
}
type TestPluginHostServer ¶
type TestPluginHostServer struct { NormalizeCatalogDataFn func(context.Context, *plgpb.NormalizeCatalogDataRequest) (*plgpb.NormalizeCatalogDataResponse, error) OnCreateCatalogFn func(context.Context, *plgpb.OnCreateCatalogRequest) (*plgpb.OnCreateCatalogResponse, error) OnUpdateCatalogFn func(context.Context, *plgpb.OnUpdateCatalogRequest) (*plgpb.OnUpdateCatalogResponse, error) OnDeleteCatalogFn func(context.Context, *plgpb.OnDeleteCatalogRequest) (*plgpb.OnDeleteCatalogResponse, error) NormalizeSetDataFn func(context.Context, *plgpb.NormalizeSetDataRequest) (*plgpb.NormalizeSetDataResponse, error) OnCreateSetFn func(context.Context, *plgpb.OnCreateSetRequest) (*plgpb.OnCreateSetResponse, error) OnUpdateSetFn func(context.Context, *plgpb.OnUpdateSetRequest) (*plgpb.OnUpdateSetResponse, error) OnDeleteSetFn func(context.Context, *plgpb.OnDeleteSetRequest) (*plgpb.OnDeleteSetResponse, error) ListHostsFn func(context.Context, *plgpb.ListHostsRequest) (*plgpb.ListHostsResponse, error) plgpb.UnimplementedHostPluginServiceServer }
TestPluginHostServer provides a host plugin service server where each method can be overwritten for tests.
func (TestPluginHostServer) ListHosts ¶
func (t TestPluginHostServer) ListHosts(ctx context.Context, req *plgpb.ListHostsRequest) (*plgpb.ListHostsResponse, error)
func (TestPluginHostServer) NormalizeCatalogData ¶
func (t TestPluginHostServer) NormalizeCatalogData(ctx context.Context, req *plgpb.NormalizeCatalogDataRequest) (*plgpb.NormalizeCatalogDataResponse, error)
func (TestPluginHostServer) NormalizeSetData ¶
func (t TestPluginHostServer) NormalizeSetData(ctx context.Context, req *plgpb.NormalizeSetDataRequest) (*plgpb.NormalizeSetDataResponse, error)
func (TestPluginHostServer) OnCreateCatalog ¶
func (t TestPluginHostServer) OnCreateCatalog(ctx context.Context, req *plgpb.OnCreateCatalogRequest) (*plgpb.OnCreateCatalogResponse, error)
func (TestPluginHostServer) OnCreateSet ¶
func (t TestPluginHostServer) OnCreateSet(ctx context.Context, req *plgpb.OnCreateSetRequest) (*plgpb.OnCreateSetResponse, error)
func (TestPluginHostServer) OnDeleteCatalog ¶
func (t TestPluginHostServer) OnDeleteCatalog(ctx context.Context, req *plgpb.OnDeleteCatalogRequest) (*plgpb.OnDeleteCatalogResponse, error)
func (TestPluginHostServer) OnDeleteSet ¶
func (t TestPluginHostServer) OnDeleteSet(ctx context.Context, req *plgpb.OnDeleteSetRequest) (*plgpb.OnDeleteSetResponse, error)
func (TestPluginHostServer) OnUpdateCatalog ¶
func (t TestPluginHostServer) OnUpdateCatalog(ctx context.Context, req *plgpb.OnUpdateCatalogRequest) (*plgpb.OnUpdateCatalogResponse, error)
func (TestPluginHostServer) OnUpdateSet ¶
func (t TestPluginHostServer) OnUpdateSet(ctx context.Context, req *plgpb.OnUpdateSetRequest) (*plgpb.OnUpdateSetResponse, error)
type TestPluginServer ¶
type TestPluginServer struct { TestPluginHostServer TestPluginStorageServer }
TestPluginServer provides a host and storage plugin service server where each method can be overwritten for tests.
type TestPluginStorageServer ¶
type TestPluginStorageServer struct { OnCreateStorageBucketFn func(context.Context, *plgpb.OnCreateStorageBucketRequest) (*plgpb.OnCreateStorageBucketResponse, error) OnUpdateStorageBucketFn func(context.Context, *plgpb.OnUpdateStorageBucketRequest) (*plgpb.OnUpdateStorageBucketResponse, error) OnDeleteStorageBucketFn func(context.Context, *plgpb.OnDeleteStorageBucketRequest) (*plgpb.OnDeleteStorageBucketResponse, error) ValidatePermissionsFn func(context.Context, *plgpb.ValidatePermissionsRequest) (*plgpb.ValidatePermissionsResponse, error) HeadObjectFn func(context.Context, *plgpb.HeadObjectRequest) (*plgpb.HeadObjectResponse, error) GetObjectFn func(*plgpb.GetObjectRequest, plgpb.StoragePluginService_GetObjectServer) error PutObjectFn func(context.Context, *plgpb.PutObjectRequest) (*plgpb.PutObjectResponse, error) plgpb.UnimplementedStoragePluginServiceServer }
TestPluginStorageServer provides a storage plugin service server where each method can be overwritten for tests.
func (TestPluginStorageServer) GetObject ¶
func (t TestPluginStorageServer) GetObject(req *plgpb.GetObjectRequest, stream plgpb.StoragePluginService_GetObjectServer) error
func (TestPluginStorageServer) HeadObject ¶
func (t TestPluginStorageServer) HeadObject(ctx context.Context, req *plgpb.HeadObjectRequest) (*plgpb.HeadObjectResponse, error)
func (TestPluginStorageServer) OnCreateStorageBucket ¶
func (t TestPluginStorageServer) OnCreateStorageBucket(ctx context.Context, req *plgpb.OnCreateStorageBucketRequest) (*plgpb.OnCreateStorageBucketResponse, error)
func (TestPluginStorageServer) OnDeleteStorageBucket ¶
func (t TestPluginStorageServer) OnDeleteStorageBucket(ctx context.Context, req *plgpb.OnDeleteStorageBucketRequest) (*plgpb.OnDeleteStorageBucketResponse, error)
func (TestPluginStorageServer) OnUpdateStorageBucket ¶
func (t TestPluginStorageServer) OnUpdateStorageBucket(ctx context.Context, req *plgpb.OnUpdateStorageBucketRequest) (*plgpb.OnUpdateStorageBucketResponse, error)
func (TestPluginStorageServer) PutObject ¶
func (t TestPluginStorageServer) PutObject(ctx context.Context, req *plgpb.PutObjectRequest) (*plgpb.PutObjectResponse, error)
func (TestPluginStorageServer) ValidatePermissions ¶
func (t TestPluginStorageServer) ValidatePermissions(ctx context.Context, req *plgpb.ValidatePermissionsRequest) (*plgpb.ValidatePermissionsResponse, error)
type WrappingPluginHostClient ¶
type WrappingPluginHostClient struct {
Server plgpb.HostPluginServiceServer
}
WrappingPluginHostClient provides a wrapper around a Server implementation that can be used when loading a plugin in-memory. Supports HostServiceServer
func NewWrappingPluginHostClient ¶
func NewWrappingPluginHostClient(s plgpb.HostPluginServiceServer) *WrappingPluginHostClient
func (*WrappingPluginHostClient) ListHosts ¶
func (tpc *WrappingPluginHostClient) ListHosts(ctx context.Context, req *plgpb.ListHostsRequest, opts ...grpc.CallOption) (*plgpb.ListHostsResponse, error)
func (*WrappingPluginHostClient) NormalizeCatalogData ¶
func (tpc *WrappingPluginHostClient) NormalizeCatalogData(ctx context.Context, req *plgpb.NormalizeCatalogDataRequest, opts ...grpc.CallOption) (*plgpb.NormalizeCatalogDataResponse, error)
func (*WrappingPluginHostClient) NormalizeSetData ¶
func (tpc *WrappingPluginHostClient) NormalizeSetData(ctx context.Context, req *plgpb.NormalizeSetDataRequest, opts ...grpc.CallOption) (*plgpb.NormalizeSetDataResponse, error)
func (*WrappingPluginHostClient) OnCreateCatalog ¶
func (tpc *WrappingPluginHostClient) OnCreateCatalog(ctx context.Context, req *plgpb.OnCreateCatalogRequest, opts ...grpc.CallOption) (*plgpb.OnCreateCatalogResponse, error)
func (*WrappingPluginHostClient) OnCreateSet ¶
func (tpc *WrappingPluginHostClient) OnCreateSet(ctx context.Context, req *plgpb.OnCreateSetRequest, opts ...grpc.CallOption) (*plgpb.OnCreateSetResponse, error)
func (*WrappingPluginHostClient) OnDeleteCatalog ¶
func (tpc *WrappingPluginHostClient) OnDeleteCatalog(ctx context.Context, req *plgpb.OnDeleteCatalogRequest, opts ...grpc.CallOption) (*plgpb.OnDeleteCatalogResponse, error)
func (*WrappingPluginHostClient) OnDeleteSet ¶
func (tpc *WrappingPluginHostClient) OnDeleteSet(ctx context.Context, req *plgpb.OnDeleteSetRequest, opts ...grpc.CallOption) (*plgpb.OnDeleteSetResponse, error)
func (*WrappingPluginHostClient) OnUpdateCatalog ¶
func (tpc *WrappingPluginHostClient) OnUpdateCatalog(ctx context.Context, req *plgpb.OnUpdateCatalogRequest, opts ...grpc.CallOption) (*plgpb.OnUpdateCatalogResponse, error)
func (*WrappingPluginHostClient) OnUpdateSet ¶
func (tpc *WrappingPluginHostClient) OnUpdateSet(ctx context.Context, req *plgpb.OnUpdateSetRequest, opts ...grpc.CallOption) (*plgpb.OnUpdateSetResponse, error)
type WrappingPluginStorageClient ¶
type WrappingPluginStorageClient struct {
Server plgpb.StoragePluginServiceServer
}
WrappingPluginStorageClient provides a wrapper around a Server implementation that can be used when loading a plugin in-memory. Supports StoragePluginServiceClient
func NewWrappingPluginStorageClient ¶
func NewWrappingPluginStorageClient(s plgpb.StoragePluginServiceServer) *WrappingPluginStorageClient
func (*WrappingPluginStorageClient) GetObject ¶
func (tpc *WrappingPluginStorageClient) GetObject(ctx context.Context, req *plgpb.GetObjectRequest, opts ...grpc.CallOption) (plgpb.StoragePluginService_GetObjectClient, error)
func (*WrappingPluginStorageClient) HeadObject ¶
func (tpc *WrappingPluginStorageClient) HeadObject(ctx context.Context, req *plgpb.HeadObjectRequest, opts ...grpc.CallOption) (*plgpb.HeadObjectResponse, error)
func (*WrappingPluginStorageClient) OnCreateStorageBucket ¶
func (tpc *WrappingPluginStorageClient) OnCreateStorageBucket(ctx context.Context, req *plgpb.OnCreateStorageBucketRequest, opts ...grpc.CallOption) (*plgpb.OnCreateStorageBucketResponse, error)
func (*WrappingPluginStorageClient) OnDeleteStorageBucket ¶
func (tpc *WrappingPluginStorageClient) OnDeleteStorageBucket(ctx context.Context, req *plgpb.OnDeleteStorageBucketRequest, opts ...grpc.CallOption) (*plgpb.OnDeleteStorageBucketResponse, error)
func (*WrappingPluginStorageClient) OnUpdateStorageBucket ¶
func (tpc *WrappingPluginStorageClient) OnUpdateStorageBucket(ctx context.Context, req *plgpb.OnUpdateStorageBucketRequest, opts ...grpc.CallOption) (*plgpb.OnUpdateStorageBucketResponse, error)
func (*WrappingPluginStorageClient) PutObject ¶
func (tpc *WrappingPluginStorageClient) PutObject(ctx context.Context, req *plgpb.PutObjectRequest, opts ...grpc.CallOption) (*plgpb.PutObjectResponse, error)
func (*WrappingPluginStorageClient) ValidatePermissions ¶
func (tpc *WrappingPluginStorageClient) ValidatePermissions(ctx context.Context, req *plgpb.ValidatePermissionsRequest, opts ...grpc.CallOption) (*plgpb.ValidatePermissionsResponse, error)