tablediff

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DiffTypeChanged = "changed"
	DiffTypeDropped = "dropped"
	DiffTypeCreated = "created"
	OpTypeCreate    = "create"
	OpTypeUpdate    = "update"
	OpTypeDelete    = "delete"
	OpTypeUnknown   = "unknown"
)
View Source
const (
	ControllerTestPlugin = "controller"
	PluginPath           = "plugin_path"
	PluginVersion        = "plugin_version"
)

Variables

View Source
var (
	ErrTableNotFound = errors.New("table not found")
	ErrLoadingPlugin = errors.New("failed to load diff plugin")
	ErrFailedDiff    = errors.New("failed to run diff")
)
View Source
var (
	DiffType_name = map[int32]string{
		0: "CHANGED",
		1: "CREATED",
		2: "DROPPED",
	}
	DiffType_value = map[string]int32{
		"CHANGED": 0,
		"CREATED": 1,
		"DROPPED": 2,
	}
)

Enum value maps for DiffType.

View Source
var (
	OperationType_name = map[int32]string{
		0: "CREATE",
		1: "UPDATE",
		2: "DELETE",
		3: "UNKNOWN",
	}
	OperationType_value = map[string]int32{
		"CREATE":  0,
		"UPDATE":  1,
		"DELETE":  2,
		"UNKNOWN": 3,
	}
)

Enum value maps for OperationType.

View Source
var ErrDiffFailed = errors.New("failed")
View Source
var ErrNotFound = errors.New("plugin not found")
View Source
var File_plugins_diff_table_diff_proto protoreflect.FileDescriptor
View Source
var TableDiffer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "diff.TableDiffer",
	HandlerType: (*TableDifferServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "TableDiff",
			Handler:    _TableDiffer_TableDiff_Handler,
		},
		{
			MethodName: "ShowHistory",
			Handler:    _TableDiffer_ShowHistory_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "table_diff.proto",
}

TableDiffer_ServiceDesc is the grpc.ServiceDesc for TableDiffer service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func ContextWithError added in v0.94.0

func ContextWithError(ctx context.Context, e error) context.Context

func ErrorFromContext added in v0.94.0

func ErrorFromContext(ctx context.Context) error

func RegisterDeltaLakeDiffPlugin added in v0.94.0

func RegisterDeltaLakeDiffPlugin(ds *Service, pid plugins.PluginIdentity, handshake plugins.PluginHandshake)

func RegisterTableDifferServer

func RegisterTableDifferServer(s grpc.ServiceRegistrar, srv TableDifferServer)

Types

type ControllerTestDiffer added in v0.94.0

type ControllerTestDiffer struct{}

func (ControllerTestDiffer) Diff added in v0.94.0

type DeltaDiffGRPCPlugin added in v0.94.0

type DeltaDiffGRPCPlugin struct {
	// DeltaDiffGRPCPlugin must implement the Plugin interface
	plugin.Plugin
}

DeltaDiffGRPCPlugin is responsible for generating a client and a server for the Delta Lake Diff plugin implementation.

func (DeltaDiffGRPCPlugin) GRPCClient added in v0.94.0

func (p DeltaDiffGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient will return the Delta diff GRPC custom client

func (DeltaDiffGRPCPlugin) GRPCServer added in v0.94.0

func (p DeltaDiffGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer must be implemented even though we won't use it. Delta Lake's server implementation is written in Rust.

type DeltaLakeDiffer added in v0.94.0

type DeltaLakeDiffer struct {
	// contains filtered or unexported fields
}

func (*DeltaLakeDiffer) Diff added in v0.94.0

func (d *DeltaLakeDiffer) Diff(ctx context.Context, ps Params) (Response, error)

type DiffEntry added in v0.94.0

type DiffEntry struct {
	ID               string
	Timestamp        time.Time
	Operation        string
	OperationContent map[string]string
	OperationType    string
}

type DiffProps

type DiffProps struct {
	Repo           string     `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
	LeftTablePath  *TablePath `protobuf:"bytes,2,opt,name=left_table_path,json=leftTablePath,proto3" json:"left_table_path,omitempty"`
	RightTablePath *TablePath `protobuf:"bytes,3,opt,name=right_table_path,json=rightTablePath,proto3" json:"right_table_path,omitempty"`
	BaseTablePath  *TablePath `protobuf:"bytes,4,opt,name=base_table_path,json=baseTablePath,proto3,oneof" json:"base_table_path,omitempty"`
	// contains filtered or unexported fields
}

func (*DiffProps) Descriptor deprecated

func (*DiffProps) Descriptor() ([]byte, []int)

Deprecated: Use DiffProps.ProtoReflect.Descriptor instead.

func (*DiffProps) GetBaseTablePath

func (x *DiffProps) GetBaseTablePath() *TablePath

func (*DiffProps) GetLeftTablePath

func (x *DiffProps) GetLeftTablePath() *TablePath

func (*DiffProps) GetRepo

func (x *DiffProps) GetRepo() string

func (*DiffProps) GetRightTablePath

func (x *DiffProps) GetRightTablePath() *TablePath

func (*DiffProps) ProtoMessage

func (*DiffProps) ProtoMessage()

func (*DiffProps) ProtoReflect

func (x *DiffProps) ProtoReflect() protoreflect.Message

func (*DiffProps) Reset

func (x *DiffProps) Reset()

func (*DiffProps) String

func (x *DiffProps) String() string

type DiffType added in v0.94.0

type DiffType int32
const (
	DiffType_CHANGED DiffType = 0
	DiffType_CREATED DiffType = 1
	DiffType_DROPPED DiffType = 2
)

func (DiffType) Descriptor added in v0.94.0

func (DiffType) Descriptor() protoreflect.EnumDescriptor

func (DiffType) Enum added in v0.94.0

func (x DiffType) Enum() *DiffType

func (DiffType) EnumDescriptor deprecated added in v0.94.0

func (DiffType) EnumDescriptor() ([]byte, []int)

Deprecated: Use DiffType.Descriptor instead.

func (DiffType) Number added in v0.94.0

func (x DiffType) Number() protoreflect.EnumNumber

func (DiffType) String added in v0.94.0

func (x DiffType) String() string

func (DiffType) Type added in v0.94.0

type Differ added in v0.94.0

type Differ interface {
	Diff(context.Context, Params) (Response, error)
}

type GatewayConfig

type GatewayConfig struct {
	Key      string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Secret   string `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"`
	Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	// contains filtered or unexported fields
}

func (*GatewayConfig) Descriptor deprecated

func (*GatewayConfig) Descriptor() ([]byte, []int)

Deprecated: Use GatewayConfig.ProtoReflect.Descriptor instead.

func (*GatewayConfig) GetEndpoint

func (x *GatewayConfig) GetEndpoint() string

func (*GatewayConfig) GetKey

func (x *GatewayConfig) GetKey() string

func (*GatewayConfig) GetSecret

func (x *GatewayConfig) GetSecret() string

func (*GatewayConfig) ProtoMessage

func (*GatewayConfig) ProtoMessage()

func (*GatewayConfig) ProtoReflect

func (x *GatewayConfig) ProtoReflect() protoreflect.Message

func (*GatewayConfig) Reset

func (x *GatewayConfig) Reset()

func (*GatewayConfig) String

func (x *GatewayConfig) String() string

type MockHandler added in v0.94.0

type MockHandler struct {
	// contains filtered or unexported fields
}

func NewMockHandler added in v0.94.0

func NewMockHandler() *MockHandler

func (*MockHandler) LoadPluginClient added in v0.94.0

func (mh *MockHandler) LoadPluginClient(name string) (Differ, func(), error)

func (*MockHandler) Plugins added in v0.98.0

func (mh *MockHandler) Plugins() []string

func (*MockHandler) RegisterPlugin added in v0.94.0

func (mh *MockHandler) RegisterPlugin(name string, pp internal.HCPluginProperties)

type OperationType added in v0.94.0

type OperationType int32
const (
	OperationType_CREATE  OperationType = 0
	OperationType_UPDATE  OperationType = 1
	OperationType_DELETE  OperationType = 2
	OperationType_UNKNOWN OperationType = 3
)

func (OperationType) Descriptor added in v0.94.0

func (OperationType) Enum added in v0.94.0

func (x OperationType) Enum() *OperationType

func (OperationType) EnumDescriptor deprecated added in v0.94.0

func (OperationType) EnumDescriptor() ([]byte, []int)

Deprecated: Use OperationType.Descriptor instead.

func (OperationType) Number added in v0.94.0

func (OperationType) String added in v0.94.0

func (x OperationType) String() string

func (OperationType) Type added in v0.94.0

type Params added in v0.94.0

type Params struct {
	TablePaths TablePaths
	S3Creds    S3Creds
	Repo       string
}

type RefPath added in v0.94.0

type RefPath struct {
	Ref  string
	Path string
}

type Response added in v0.94.0

type Response struct {
	DiffType string
	Diffs    []DiffEntry
}

type S3Creds added in v0.94.0

type S3Creds struct {
	Key      config.SecureString
	Secret   config.SecureString
	Endpoint string
}

type Service added in v0.94.0

type Service struct {
	// contains filtered or unexported fields
}

Service is responsible for registering new Differ plugins and executing them at will. After initializing a Service, the CloseClients method should be called at some point to close gracefully all remaining plugins.

func NewMockService added in v0.94.0

func NewMockService() *Service

func NewService added in v0.94.0

func NewService(diffProps config.DiffProps, pluginProps config.Plugins) (*Service, func())

NewService is used to initialize a new Differ service. The returned function is a closing function for the service.

func (*Service) Close added in v0.94.0

func (s *Service) Close()

Close should be called upon the destruction of the Service.

func (*Service) EnabledDiffs added in v0.98.0

func (s *Service) EnabledDiffs() []string

func (*Service) RunDiff added in v0.94.0

func (s *Service) RunDiff(ctx context.Context, diffType string, diffParams Params) (Response, error)

type ShowHistoryRequest added in v1.0.0

type ShowHistoryRequest struct {
	Path *TablePath `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	// contains filtered or unexported fields
}

func (*ShowHistoryRequest) Descriptor deprecated added in v1.0.0

func (*ShowHistoryRequest) Descriptor() ([]byte, []int)

Deprecated: Use ShowHistoryRequest.ProtoReflect.Descriptor instead.

func (*ShowHistoryRequest) GetPath added in v1.0.0

func (x *ShowHistoryRequest) GetPath() *TablePath

func (*ShowHistoryRequest) ProtoMessage added in v1.0.0

func (*ShowHistoryRequest) ProtoMessage()

func (*ShowHistoryRequest) ProtoReflect added in v1.0.0

func (x *ShowHistoryRequest) ProtoReflect() protoreflect.Message

func (*ShowHistoryRequest) Reset added in v1.0.0

func (x *ShowHistoryRequest) Reset()

func (*ShowHistoryRequest) String added in v1.0.0

func (x *ShowHistoryRequest) String() string

type ShowHistoryResponse added in v1.0.0

type ShowHistoryResponse struct {
	Entries []*TableOperation `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

func (*ShowHistoryResponse) Descriptor deprecated added in v1.0.0

func (*ShowHistoryResponse) Descriptor() ([]byte, []int)

Deprecated: Use ShowHistoryResponse.ProtoReflect.Descriptor instead.

func (*ShowHistoryResponse) GetEntries added in v1.0.0

func (x *ShowHistoryResponse) GetEntries() []*TableOperation

func (*ShowHistoryResponse) ProtoMessage added in v1.0.0

func (*ShowHistoryResponse) ProtoMessage()

func (*ShowHistoryResponse) ProtoReflect added in v1.0.0

func (x *ShowHistoryResponse) ProtoReflect() protoreflect.Message

func (*ShowHistoryResponse) Reset added in v1.0.0

func (x *ShowHistoryResponse) Reset()

func (*ShowHistoryResponse) String added in v1.0.0

func (x *ShowHistoryResponse) String() string

type TableDiffRequest added in v1.0.0

type TableDiffRequest struct {
	Props         *DiffProps     `protobuf:"bytes,1,opt,name=props,proto3" json:"props,omitempty"`
	GatewayConfig *GatewayConfig `protobuf:"bytes,2,opt,name=gateway_config,json=gatewayConfig,proto3" json:"gateway_config,omitempty"`
	// contains filtered or unexported fields
}

func (*TableDiffRequest) Descriptor deprecated added in v1.0.0

func (*TableDiffRequest) Descriptor() ([]byte, []int)

Deprecated: Use TableDiffRequest.ProtoReflect.Descriptor instead.

func (*TableDiffRequest) GetGatewayConfig added in v1.0.0

func (x *TableDiffRequest) GetGatewayConfig() *GatewayConfig

func (*TableDiffRequest) GetProps added in v1.0.0

func (x *TableDiffRequest) GetProps() *DiffProps

func (*TableDiffRequest) ProtoMessage added in v1.0.0

func (*TableDiffRequest) ProtoMessage()

func (*TableDiffRequest) ProtoReflect added in v1.0.0

func (x *TableDiffRequest) ProtoReflect() protoreflect.Message

func (*TableDiffRequest) Reset added in v1.0.0

func (x *TableDiffRequest) Reset()

func (*TableDiffRequest) String added in v1.0.0

func (x *TableDiffRequest) String() string

type TableDiffResponse added in v1.0.0

type TableDiffResponse struct {
	Entries  []*TableOperation `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	DiffType DiffType          `protobuf:"varint,2,opt,name=diff_type,json=diffType,proto3,enum=diff.DiffType" json:"diff_type,omitempty"`
	// contains filtered or unexported fields
}

func (*TableDiffResponse) Descriptor deprecated added in v1.0.0

func (*TableDiffResponse) Descriptor() ([]byte, []int)

Deprecated: Use TableDiffResponse.ProtoReflect.Descriptor instead.

func (*TableDiffResponse) GetDiffType added in v1.0.0

func (x *TableDiffResponse) GetDiffType() DiffType

func (*TableDiffResponse) GetEntries added in v1.0.0

func (x *TableDiffResponse) GetEntries() []*TableOperation

func (*TableDiffResponse) ProtoMessage added in v1.0.0

func (*TableDiffResponse) ProtoMessage()

func (*TableDiffResponse) ProtoReflect added in v1.0.0

func (x *TableDiffResponse) ProtoReflect() protoreflect.Message

func (*TableDiffResponse) Reset added in v1.0.0

func (x *TableDiffResponse) Reset()

func (*TableDiffResponse) String added in v1.0.0

func (x *TableDiffResponse) String() string

type TableDifferClient

type TableDifferClient interface {
	TableDiff(ctx context.Context, in *TableDiffRequest, opts ...grpc.CallOption) (*TableDiffResponse, error)
	ShowHistory(ctx context.Context, in *ShowHistoryRequest, opts ...grpc.CallOption) (*ShowHistoryResponse, error)
}

TableDifferClient is the client API for TableDiffer service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type TableDifferServer

type TableDifferServer interface {
	TableDiff(context.Context, *TableDiffRequest) (*TableDiffResponse, error)
	ShowHistory(context.Context, *ShowHistoryRequest) (*ShowHistoryResponse, error)
	// contains filtered or unexported methods
}

TableDifferServer is the server API for TableDiffer service. All implementations must embed UnimplementedTableDifferServer for forward compatibility

type TableOperation

type TableOperation struct {
	Id            string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Timestamp     *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Operation     string                 `protobuf:"bytes,3,opt,name=operation,proto3" json:"operation,omitempty"`
	Content       map[string]string      `` /* 155-byte string literal not displayed */
	OperationType OperationType          `protobuf:"varint,5,opt,name=operation_type,json=operationType,proto3,enum=diff.OperationType" json:"operation_type,omitempty"`
	// contains filtered or unexported fields
}

Example id: "2" timestamp: 2023-02-05T01:30:15.01Z operation: "DELETE" content: { "predicate": "[\"(spark_catalog.delta.lakefs://repo/branch/my-delta-lake-table/.`feature` < 5.0D)\"]"} }

func (*TableOperation) Descriptor deprecated

func (*TableOperation) Descriptor() ([]byte, []int)

Deprecated: Use TableOperation.ProtoReflect.Descriptor instead.

func (*TableOperation) GetContent

func (x *TableOperation) GetContent() map[string]string

func (*TableOperation) GetId

func (x *TableOperation) GetId() string

func (*TableOperation) GetOperation

func (x *TableOperation) GetOperation() string

func (*TableOperation) GetOperationType added in v0.94.0

func (x *TableOperation) GetOperationType() OperationType

func (*TableOperation) GetTimestamp

func (x *TableOperation) GetTimestamp() *timestamppb.Timestamp

func (*TableOperation) ProtoMessage

func (*TableOperation) ProtoMessage()

func (*TableOperation) ProtoReflect

func (x *TableOperation) ProtoReflect() protoreflect.Message

func (*TableOperation) Reset

func (x *TableOperation) Reset()

func (*TableOperation) String

func (x *TableOperation) String() string

type TablePath

type TablePath struct {
	Ref  string `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"`
	Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	// contains filtered or unexported fields
}

func (*TablePath) Descriptor deprecated

func (*TablePath) Descriptor() ([]byte, []int)

Deprecated: Use TablePath.ProtoReflect.Descriptor instead.

func (*TablePath) GetPath

func (x *TablePath) GetPath() string

func (*TablePath) GetRef

func (x *TablePath) GetRef() string

func (*TablePath) ProtoMessage

func (*TablePath) ProtoMessage()

func (*TablePath) ProtoReflect

func (x *TablePath) ProtoReflect() protoreflect.Message

func (*TablePath) Reset

func (x *TablePath) Reset()

func (*TablePath) String

func (x *TablePath) String() string

type TablePaths added in v0.94.0

type TablePaths struct {
	Left  RefPath
	Right RefPath
	Base  RefPath
}

type TestDiffer added in v0.94.0

type TestDiffer struct {
	// contains filtered or unexported fields
}

func (TestDiffer) Diff added in v0.94.0

func (td TestDiffer) Diff(ctx context.Context, p Params) (Response, error)

type UnimplementedTableDifferServer

type UnimplementedTableDifferServer struct {
}

UnimplementedTableDifferServer must be embedded to have forward compatible implementations.

func (UnimplementedTableDifferServer) ShowHistory

func (UnimplementedTableDifferServer) TableDiff

type UnsafeTableDifferServer

type UnsafeTableDifferServer interface {
	// contains filtered or unexported methods
}

UnsafeTableDifferServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TableDifferServer will result in compilation errors.

Jump to

Keyboard shortcuts

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