Documentation ¶
Index ¶
- func GitAuthPrivateKey(pem []byte) (protocol.GitAuth, error)
- type CompactSpec
- type CompactSpecParser
- type DefaultFileStoreFactory
- type DefaultPathResolver
- type EntityBasedStore
- func (e *EntityBasedStore) Create(spec *protocol.ToleranceSpec) error
- func (e *EntityBasedStore) Delete(tableID string) error
- func (e *EntityBasedStore) GetAll() ([]*protocol.ToleranceSpec, error)
- func (e *EntityBasedStore) GetByProjectID(projectID string) ([]*protocol.ToleranceSpec, error)
- func (e *EntityBasedStore) GetByTableID(tableID string) (*protocol.ToleranceSpec, error)
- func (e *EntityBasedStore) GetResourceNames() ([]string, error)
- type Factory
- type Field
- type FileBasedStore
- func (f *FileBasedStore) Create(spec *protocol.ToleranceSpec) error
- func (f *FileBasedStore) Delete(tableID string) error
- func (f *FileBasedStore) GetAll() ([]*protocol.ToleranceSpec, error)
- func (f *FileBasedStore) GetByProjectID(projectID string) ([]*protocol.ToleranceSpec, error)
- func (f *FileBasedStore) GetByTableID(tableID string) (*protocol.ToleranceSpec, error)
- func (f *FileBasedStore) GetResourceNames() ([]string, error)
- type FlatSpec
- type FlatSpecParser
- type GcsFileStorage
- func (r *GcsFileStorage) Create(file *protocol.File) (err error)
- func (r *GcsFileStorage) Delete(filePath string) error
- func (r *GcsFileStorage) Get(filePath string) (file *protocol.File, err error)
- func (r *GcsFileStorage) GetAll() ([]*protocol.File, error)
- func (r *GcsFileStorage) GetPaths() ([]string, error)
- type GitPathResolver
- type GitRepository
- type GitRepositoryFactory
- type LocalFileStorage
- func (l *LocalFileStorage) Create(file *protocol.File) error
- func (l *LocalFileStorage) Delete(filePath string) error
- func (l *LocalFileStorage) Get(filePath string) (*protocol.File, error)
- func (l *LocalFileStorage) GetAll() ([]*protocol.File, error)
- func (l *LocalFileStorage) GetPaths() ([]string, error)
- type Metadata
- type MetricSpec
- type MultiTenancyPathResolver
- type Parser
- type PathResolverFactory
- type RulesMap
- type SmartParser
- type SpecValidator
- type Tolerance
- type Upload
- type UploadFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompactSpec ¶
type CompactSpec struct { TableID string TableMetrics []*MetricSpec Fields []*Field }
CompactSpec compact tolerance spec is structured json/yaml schema with less redundant fields
type CompactSpecParser ¶
type CompactSpecParser struct { }
CompactSpecParser is parser for CompactSpec
func (*CompactSpecParser) Parse ¶
func (s *CompactSpecParser) Parse(content []byte) (*protocol.ToleranceSpec, error)
func (*CompactSpecParser) Serialise ¶
func (s *CompactSpecParser) Serialise(toleranceSpec *protocol.ToleranceSpec) (content []byte, err error)
type DefaultFileStoreFactory ¶
type DefaultFileStoreFactory struct {
// contains filtered or unexported fields
}
DefaultFileStoreFactory to create specific FileBasedToleranceRepository from URL path
func NewFileStoreFactory ¶
func NewFileStoreFactory(client stiface.Client) *DefaultFileStoreFactory
NewFileStoreFactory to create FileBasedToleranceRepository based on URL path
type DefaultPathResolver ¶
type DefaultPathResolver struct { }
DefaultPathResolver to get file path with {project-id}.{dataset}.{tablename}.yaml format this is the default setting that applied without multi tenancy enabled
type EntityBasedStore ¶
type EntityBasedStore struct {
// contains filtered or unexported fields
}
func NewEntityBasedStore ¶
func NewEntityBasedStore(entity *protocol.Entity, source protocol.ToleranceStore) *EntityBasedStore
func (*EntityBasedStore) Create ¶
func (e *EntityBasedStore) Create(spec *protocol.ToleranceSpec) error
func (*EntityBasedStore) Delete ¶
func (e *EntityBasedStore) Delete(tableID string) error
func (*EntityBasedStore) GetAll ¶
func (e *EntityBasedStore) GetAll() ([]*protocol.ToleranceSpec, error)
func (*EntityBasedStore) GetByProjectID ¶
func (e *EntityBasedStore) GetByProjectID(projectID string) ([]*protocol.ToleranceSpec, error)
func (*EntityBasedStore) GetByTableID ¶
func (e *EntityBasedStore) GetByTableID(tableID string) (*protocol.ToleranceSpec, error)
func (*EntityBasedStore) GetResourceNames ¶
func (e *EntityBasedStore) GetResourceNames() ([]string, error)
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(resolverFactory *PathResolverFactory, fileStoreFactory protocol.FileStoreFactory) *Factory
NewFactory create Factory of protocol.ToleranceStore
func (*Factory) Create ¶
Create multiple implementation of protocol.ToleranceStore this Method only support protocol.MultiTenancy and protocol.Default protocol.PathType directory structure of protocol.PathResolver
func (*Factory) CreateWithOptions ¶
func (t *Factory) CreateWithOptions(store protocol.FileStore, pathType protocol.PathType) (protocol.ToleranceStore, error)
CreateWithOptions intended to create more customised version of protocol.ToleranceStore this support custom protocol.FileStore and all of protocol.PathType including protocol.MultiTenancy, protocol.Default and protocol.Git
type Field ¶
type Field struct { FieldID string FieldMetrics []*MetricSpec }
type FileBasedStore ¶
type FileBasedStore struct {
// contains filtered or unexported fields
}
FileBasedStore is storage of tolerance spec that use file as storage
func NewFileBasedStore ¶
func NewFileBasedStore(toleranceRepo protocol.FileStore, pathResolver protocol.PathResolver, parser Parser) *FileBasedStore
NewFileBasedStore is constructor
func (*FileBasedStore) Create ¶
func (f *FileBasedStore) Create(spec *protocol.ToleranceSpec) error
func (*FileBasedStore) Delete ¶
func (f *FileBasedStore) Delete(tableID string) error
func (*FileBasedStore) GetAll ¶
func (f *FileBasedStore) GetAll() ([]*protocol.ToleranceSpec, error)
func (*FileBasedStore) GetByProjectID ¶
func (f *FileBasedStore) GetByProjectID(projectID string) ([]*protocol.ToleranceSpec, error)
func (*FileBasedStore) GetByTableID ¶
func (f *FileBasedStore) GetByTableID(tableID string) (*protocol.ToleranceSpec, error)
GetByTableID to get tolerances of a table using table ID
func (*FileBasedStore) GetResourceNames ¶
func (f *FileBasedStore) GetResourceNames() ([]string, error)
type FlatSpec ¶
type FlatSpec []*Tolerance
FlatSpec is predator tolerance spec presented as list json/yaml structure
type FlatSpecParser ¶
type FlatSpecParser struct { }
FlatSpecParser is parser for FlatSpec format
func (*FlatSpecParser) Parse ¶
func (s *FlatSpecParser) Parse(content []byte) (*protocol.ToleranceSpec, error)
func (*FlatSpecParser) Serialise ¶
func (s *FlatSpecParser) Serialise(tolerances *protocol.ToleranceSpec) (content []byte, err error)
type GcsFileStorage ¶
type GcsFileStorage struct {
// contains filtered or unexported fields
}
GcsFileStorage is FileStore that use google cloud storage every file placed under basePath directory please always resolve filepath with basePath to get the fullPath
func NewGcsRepository ¶
func NewGcsRepository(client stiface.Client, gcsPath string) *GcsFileStorage
NewGcsRepository to create GcsFileStorage
func (*GcsFileStorage) Delete ¶
func (r *GcsFileStorage) Delete(filePath string) error
func (*GcsFileStorage) Get ¶
func (r *GcsFileStorage) Get(filePath string) (file *protocol.File, err error)
GetFile to read a file from google cloud storage
func (*GcsFileStorage) GetPaths ¶
func (r *GcsFileStorage) GetPaths() ([]string, error)
GetPaths get all files path only support files that has .yaml extension
type GitPathResolver ¶
type GitPathResolver struct { }
GitPathResolver is path resolver for tolerances specs in git repository the path format is {project-id}/{dataset}/{tablename}.yaml
type GitRepository ¶
type GitRepository struct {
// contains filtered or unexported fields
}
GitRepository provides a FS like access to remote git repositories It clones the repository locally, and provides a FS interface over the contents.
func (*GitRepository) Checkout ¶
func (repo *GitRepository) Checkout(commit string) (protocol.FileStore, error)
Checkout returns a Git FileSystem at a certain commit Remember to call Close on the returned FileSystem, otherwise the checked out repository on disk will not be not be deleted if commit is empty, checksout master
type GitRepositoryFactory ¶
type GitRepositoryFactory struct {
// contains filtered or unexported fields
}
GitRepositoryFactory creator of GitRepository
func NewGitRepositoryFactory ¶
func NewGitRepositoryFactory(auth protocol.GitAuth) *GitRepositoryFactory
func (*GitRepositoryFactory) Create ¶
func (g *GitRepositoryFactory) Create(url string) protocol.GitRepository
Create create GitRepository
func (*GitRepositoryFactory) CreateWithPrefix ¶
func (g *GitRepositoryFactory) CreateWithPrefix(url string, pathPrefix string) protocol.GitRepository
type LocalFileStorage ¶
type LocalFileStorage struct {
// contains filtered or unexported fields
}
LocalFileStorage is a FileBasedToleranceRepository that use local file as tolerance every files in this storage is located under baseDir always resolve the path with base dir for any operation
func NewLocalRepository ¶
func NewLocalRepository(baseDir string) *LocalFileStorage
NewLocalRepository is constructor of LocalFileStorage
func (*LocalFileStorage) Delete ¶
func (l *LocalFileStorage) Delete(filePath string) error
func (*LocalFileStorage) Get ¶
func (l *LocalFileStorage) Get(filePath string) (*protocol.File, error)
Get to read file from local directory
func (*LocalFileStorage) GetAll ¶
func (l *LocalFileStorage) GetAll() ([]*protocol.File, error)
GetAll read all files that managed by storage by convention only file with .yaml files will be returned
func (*LocalFileStorage) GetPaths ¶
func (l *LocalFileStorage) GetPaths() ([]string, error)
type Metadata ¶
type Metadata struct { //UniqueFields are metadata that required to profile unique count UniqueFields []string }
type MetricSpec ¶
type MultiTenancyPathResolver ¶
type MultiTenancyPathResolver struct {
// contains filtered or unexported fields
}
MultiTenancyPathResolver is path resolver for tolerances spec in multi tenancy configuration the path format is {environment}/{entity}/{project-id}/{dataset}/{tablename}.yaml
type Parser ¶
type Parser interface { Parse(content []byte) (*protocol.ToleranceSpec, error) Serialise(*protocol.ToleranceSpec) ([]byte, error) }
Parser is parser and serializer of tolerance spec
type PathResolverFactory ¶
type PathResolverFactory struct {
// contains filtered or unexported fields
}
func NewPathResolverFactory ¶
func NewPathResolverFactory(entityStore protocol.EntityStore) *PathResolverFactory
NewPathResolverFactory create PathResolverFactory
func (*PathResolverFactory) CreateResolver ¶
func (p *PathResolverFactory) CreateResolver(pathType protocol.PathType) protocol.PathResolver
CreateResolver create PathResolver
type RulesMap ¶
RulesMap tolerance rules as map
func NewRulesMap ¶
func NewRulesMap(rules []protocol.ToleranceRule) RulesMap
func (RulesMap) ToArray ¶
func (r RulesMap) ToArray() []protocol.ToleranceRule
type SmartParser ¶
type SmartParser struct { }
SmartParser parser that automatically Parse yaml that using either CompactSpec or FlatSpec
func NewSmartParser ¶
func NewSmartParser() *SmartParser
func (*SmartParser) Parse ¶
func (s *SmartParser) Parse(content []byte) (*protocol.ToleranceSpec, error)
func (*SmartParser) Serialise ¶
func (s *SmartParser) Serialise(tolerances *protocol.ToleranceSpec) ([]byte, error)
type SpecValidator ¶
type SpecValidator struct {
// contains filtered or unexported fields
}
func NewSpecValidator ¶
func NewSpecValidator(metadataStore protocol.MetadataStore) *SpecValidator
NewSpecValidator create spec validator
func (*SpecValidator) Validate ¶
func (d *SpecValidator) Validate(spec *protocol.ToleranceSpec) error
type Tolerance ¶
type Tolerance struct { ID string TableID string FieldID string MetricName metric.Type ToleranceRules RulesMap CreatedAt time.Time UpdatedAt time.Time }
Tolerance is format of tolerance configuration
func (*Tolerance) ToTolerance ¶
type UploadFactory ¶
type UploadFactory struct {
// contains filtered or unexported fields
}
func NewUploadFactory ¶
func NewUploadFactory(multiTenancyEnabled bool, entityStore protocol.EntityStore, sourceFactory protocol.ToleranceStoreFactory, destination protocol.ToleranceStore, gitRepositoryFactory protocol.GitRepositoryFactory, statsFactory stats.ClientBuilder, metadataStore protocol.MetadataStore) *UploadFactory
NewUploadFactory create UploadFactory