internal

package
v0.0.0-...-7c47925 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProtoMd5Sum

func GetProtoMd5Sum(protoMessage protoreflect.ProtoMessage) ([]byte, error)

Types

type AddFileProps

type AddFileProps struct {
	// the URI of where to find the file
	URI string

	// a md5 hash or other identifier that can help determine if the file is unique
	Identifier string

	// the schema of the file
	Schema *v1alpha.Schema

	// the type of file
	FileType kaskadafile.Type
}

type DataTokenClient

type DataTokenClient interface {
	// gets the current dataToken for an owner
	GetCurrentDataToken(ctx context.Context, owner *ent.Owner) (*ent.DataToken, error)

	// gets a specific dataToken for an owner
	GetDataToken(ctx context.Context, owner *ent.Owner, id uuid.UUID) (*ent.DataToken, error)

	// gets a specific dataToken at the specified version
	GetDataTokenFromVersion(ctx context.Context, owner *ent.Owner, version int64) (*ent.DataToken, error)

	// at a specific dataToken, returns a map of tableIDs to their most recent dataVersion
	GetTableVersions(ctx context.Context, owner *ent.Owner, dataToken *ent.DataToken) (map[uuid.UUID]*ent.DataVersion, error)
}

func NewDataTokenClient

func NewDataTokenClient(entClient *ent.Client) DataTokenClient

NewDataTokenClient creates a new DataTokenClient from an ent client

type DataTokenClientProvider

type DataTokenClientProvider func(entClient *ent.Client) DataTokenClient

DataTokenClientProvider creates DataTokenClients

type FileInput

type FileInput interface {
	GetURI() string
	GetType() kaskadafile.Type
	GetExtension() string
}

func FileInputFromV1Alpha

func FileInputFromV1Alpha(input *v1alpha.FileInput) FileInput

type FileSet

type FileSet struct {
	SliceInfo   *SliceInfo
	PrepareJobs []*ent.PrepareJob
}

func GetNewFileSet

func GetNewFileSet(sliceInfo *SliceInfo, prepareJobs []*ent.PrepareJob) *FileSet

type KaskadaQueryClient

type KaskadaQueryClient interface {
	CreateKaskadaQuery(ctx context.Context, owner *ent.Owner, newQuery *ent.KaskadaQuery, isV2 bool) (*ent.KaskadaQuery, error)
	DeleteKaskadaQuery(ctx context.Context, owner *ent.Owner, id uuid.UUID, isV2 bool) error
	GetAllKaskadaQueries(ctx context.Context, owner *ent.Owner, isV2 bool) ([]*ent.KaskadaQuery, error)
	GetKaskadaQuery(ctx context.Context, owner *ent.Owner, id uuid.UUID, isV2 bool) (*ent.KaskadaQuery, error)
	ListKaskadaQueries(ctx context.Context, owner *ent.Owner, searchTerm string, pageSize int, offset int, isV2 bool) ([]*ent.KaskadaQuery, error)
}

func NewKaskadaQueryClient

func NewKaskadaQueryClient(entClient *ent.Client) KaskadaQueryClient

type KaskadaQueryClientProvider

type KaskadaQueryClientProvider func(entClient *ent.Client) KaskadaQueryClient

KaskadaQueryClientProvider creates QueryClients

type KaskadaTableClient

type KaskadaTableClient interface {
	CreateKaskadaTable(ctx context.Context, owner *ent.Owner, newTable *ent.KaskadaTable) (*ent.KaskadaTable, error)
	DeleteKaskadaTable(ctx context.Context, owner *ent.Owner, kaskadaTable *ent.KaskadaTable) (*ent.DataToken, error)
	GetAllKaskadaTables(ctx context.Context, owner *ent.Owner) ([]*ent.KaskadaTable, error)
	GetKaskadaTable(ctx context.Context, owner *ent.Owner, id uuid.UUID) (*ent.KaskadaTable, error)
	GetKaskadaTableByName(ctx context.Context, owner *ent.Owner, name string) (*ent.KaskadaTable, error)
	GetKaskadaTablesFromNames(ctx context.Context, owner *ent.Owner, names []string) (map[string]*ent.KaskadaTable, error)
	ListKaskadaTables(ctx context.Context, owner *ent.Owner, searchTerm string, pageSize int, offset int) ([]*ent.KaskadaTable, error)

	GetKaskadaTableVersion(ctx context.Context, kaskadaTable *ent.KaskadaTable) (*ent.DataVersion, error)

	GetMinTimeOfNewPreparedFiles(ctx context.Context, prepareCacheBuster int32, sliceInfo *SliceInfo, dataVersion int64) (*int64, error)

	AddFilesToTable(ctx context.Context, owner *ent.Owner, kaskadaTable *ent.KaskadaTable, newFiles []AddFileProps, newMergedSchema *v1alpha.Schema, newExternalVersion *string, cleanupOnError func() error) (*ent.DataToken, error)
	GetKaskadaFiles(ctx context.Context, owner *ent.Owner, kaskadaTable *ent.KaskadaTable, dataToken *ent.DataToken) ([]*ent.KaskadaFile, error)

	SaveComputeSnapshot(ctx context.Context, owner *ent.Owner, complilePlanHash []byte, snapshotCacheBuster int32, dataToken *ent.DataToken, path string, maxEventTime time.Time, relatedTablesIDs []uuid.UUID) error
	GetBestComputeSnapshot(ctx context.Context, owner *ent.Owner, complilePlanHash []byte, snapshotCacheBuster int32, slices []*SliceInfo, prepareCacheBuster int32) (*ent.ComputeSnapshot, error)
}

func NewKaskadaTableClient

func NewKaskadaTableClient(entClient *ent.Client) KaskadaTableClient

NewKaskadaTableClient creates a new KaskadaTableClient from an ent client

type KaskadaTableClientProvider

type KaskadaTableClientProvider func(entClient *ent.Client) KaskadaTableClient

KaskadaTableClientProvider creates KaskadaTableClients

type KaskadaViewClient

type KaskadaViewClient interface {
	CreateKaskadaView(ctx context.Context, owner *ent.Owner, newView *ent.KaskadaView, dependencies []*ent.ViewDependency) (*ent.KaskadaView, error)
	DeleteKaskadaView(ctx context.Context, owner *ent.Owner, view *ent.KaskadaView) error
	GetAllKaskadaViews(ctx context.Context, owner *ent.Owner) ([]*ent.KaskadaView, error)
	GetKaskadaView(ctx context.Context, owner *ent.Owner, id uuid.UUID) (*ent.KaskadaView, error)
	GetKaskadaViewByName(ctx context.Context, owner *ent.Owner, name string) (*ent.KaskadaView, error)
	GetKaskadaViewsFromNames(ctx context.Context, owner *ent.Owner, names []string) (map[string]*ent.KaskadaView, error)
	GetKaskadaViewsWithDependency(ctx context.Context, owner *ent.Owner, name string, dependencyType schema.DependencyType) ([]*ent.KaskadaView, error)
	ListKaskadaViews(ctx context.Context, owner *ent.Owner, searchTerm string, pageSize int, offset int) ([]*ent.KaskadaView, error)
}

func NewKaskadaViewClient

func NewKaskadaViewClient(entClient *ent.Client) KaskadaViewClient

NewKaskadaViewClient creates a new kaskadaViewClient from an ent client

type KaskadaViewClientProvider

type KaskadaViewClientProvider func(entClient *ent.Client) KaskadaViewClient

KaskadaViewClientProvider creates ViewClients

type MaterializationClient

type MaterializationClient interface {
	CreateMaterialization(ctx context.Context, owner *ent.Owner, newMaterialization *ent.Materialization, dependencies []*ent.MaterializationDependency) (*ent.Materialization, error)
	DeleteMaterialization(ctx context.Context, owner *ent.Owner, view *ent.Materialization) error
	GetAllMaterializations(ctx context.Context, owner *ent.Owner) ([]*ent.Materialization, error)
	GetAllMaterializationsBySourceType(ctx context.Context, sourceType materialization.SourceType) ([]*ent.Materialization, error)
	GetMaterialization(ctx context.Context, owner *ent.Owner, id uuid.UUID) (*ent.Materialization, error)
	GetMaterializationByName(ctx context.Context, owner *ent.Owner, name string) (*ent.Materialization, error)
	GetMaterializationsWithDependency(ctx context.Context, owner *ent.Owner, name string, dependencyType schema.DependencyType) ([]*ent.Materialization, error)
	GetMaterializationsBySourceType(ctx context.Context, owner *ent.Owner, sourceType materialization.SourceType) ([]*ent.Materialization, error)
	ListMaterializations(ctx context.Context, owner *ent.Owner, searchTerm string, pageSize int, offset int) ([]*ent.Materialization, error)
	UpdateDataVersion(ctx context.Context, materialization *ent.Materialization, newDataVersion int64) (*ent.Materialization, error)
	IncrementVersion(ctx context.Context, materialization *ent.Materialization) (*ent.Materialization, error)
}

func NewMaterializationClient

func NewMaterializationClient(entClient *ent.Client) MaterializationClient

NewMaterializationClient creates a new materializationClient from an ent client

type MaterializationClientProvider

type MaterializationClientProvider func(entClient *ent.Client) MaterializationClient

MaterializationClientProvider creates MaterializationClients

type OwnerClient

type OwnerClient interface {
	GetOwner(ctx context.Context, id uuid.UUID) (*ent.Owner, error)
	GetOwnerFromClientID(ctx context.Context, clientID string) (*ent.Owner, error)
}

func NewOwnerClient

func NewOwnerClient(entClient *ent.Client) OwnerClient

NewOwnerClient creates a new OwnerClient from an ent client

type OwnerClientProvider

type OwnerClientProvider func(entClient *ent.Client) OwnerClient

OwnerClientProvider creates OwnerClients

type PrepareJobClient

type PrepareJobClient interface {
	// creates a new prepareJob, with the passed params
	CreatePrepareJob(ctx context.Context, kaskadaFiles []*ent.KaskadaFile, sliceInfo *SliceInfo, prepareCacheBuster int32, state property.PrepareJobState) (*ent.PrepareJob, error)

	// gets an existing prepareJob. includes the following edges: KaskdaTable, KaskadaTable.Owner, KaskadaFiles, PreparedFiles
	GetPrepareJob(ctx context.Context, id uuid.UUID) (*ent.PrepareJob, error)

	// lists existing prepareJobs that match the params.  all params required execpt `additionalFilters`
	// results include the following edges for each prepareJob: KaskdaTable, KaskadaTable.Owner, KaskadaFiles, PreparedFiles
	ListPrepareJobs(ctx context.Context, kaskadaFiles []*ent.KaskadaFile, sliceInfo *SliceInfo, prepareCacheBuster int32, additonalFilters ...predicate.PrepareJob) ([]*ent.PrepareJob, error)

	// updates the prepareJob state.  if the state is the same, still updates the `update` time.
	UpdatePrepareJobState(ctx context.Context, prepareJob *ent.PrepareJob, newState property.PrepareJobState) error

	// creates preparedFiles and adds them to the prepareJob
	AddFilesToPrepareJob(ctx context.Context, prepareJob *ent.PrepareJob, preparedFilesToCreateAndAttach []*v1alpha.PreparedFile, relatedKaskadaFile *ent.KaskadaFile) error
}

func NewPrepareJobClient

func NewPrepareJobClient(entClient *ent.Client) PrepareJobClient

NewPrepareJobClient creates a new PrepareJobClient from an ent client

type PrepareJobClientProvider

type PrepareJobClientProvider func(entClient *ent.Client) PrepareJobClient

PrepareJobClientProvider creates PrepareJobClientClients

type SliceHash

type SliceHash []byte

type SliceInfo

type SliceInfo struct {
	KaskadaTable *ent.KaskadaTable
	Plan         *v1alpha.SlicePlan
	PlanHash     SliceHash
}

func GetNewSliceInfo

func GetNewSliceInfo(plan *v1alpha.SlicePlan, kaskadaTable *ent.KaskadaTable) (*SliceInfo, error)

returns a sliceInfo

type SliceTable

type SliceTable struct {
	KaskadaTable *ent.KaskadaTable
	FileSetMap   map[*SliceHash]*FileSet
}

func GetNewSliceTable

func GetNewSliceTable(kaskadaTable *ent.KaskadaTable) *SliceTable

func (SliceTable) GetSlices

func (t SliceTable) GetSlices() []*SliceInfo

Jump to

Keyboard shortcuts

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