materialize

package
v0.0.0-...-8b3bc45 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: Apache-2.0 Imports: 22 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthMaterialize        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMaterialize          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMaterialize = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Constraint_Type_name = map[int32]string{
	0: "FIELD_REQUIRED",
	1: "LOCATION_REQUIRED",
	2: "LOCATION_RECOMMENDED",
	3: "FIELD_OPTIONAL",
	4: "FIELD_FORBIDDEN",
	5: "UNSATISFIABLE",
}
View Source
var Constraint_Type_value = map[string]int32{
	"FIELD_REQUIRED":       0,
	"LOCATION_REQUIRED":    1,
	"LOCATION_RECOMMENDED": 2,
	"FIELD_OPTIONAL":       3,
	"FIELD_FORBIDDEN":      4,
	"UNSATISFIABLE":        5,
}
View Source
var ExplicitZeroCheckpoint = []byte{0xf8, 0xff, 0xff, 0xff, 0xf, 0x1}

ExplicitZeroCheckpoint is a zero-valued message encoding, implemented as a trivial encoding of the max-value 2^29-1 protobuf tag with boolean true. See TransactionResponse_Opened.FlowCheckpoint.

Functions

func RegisterDriverServer

func RegisterDriverServer(s *grpc.Server, srv DriverServer)

func RunTransactions

func RunTransactions(
	stream Driver_TransactionsServer,
	transactor Transactor,
	log *logrus.Entry,
) (_err error)

RunTransactions processes materialization protocol transactions over the established stream against a Driver.

func StageLoad

func StageLoad(
	stream interface {
		Send(*TransactionRequest) error
	},
	request **TransactionRequest,
	binding int,
	packedKey []byte,
) error

StageLoad potentially sends a previously staged Load into the stream, and then stages its arguments into request.Load.

func StageLoaded

func StageLoaded(
	stream interface {
		Send(*TransactionResponse) error
	},
	response **TransactionResponse,
	binding int,
	document json.RawMessage,
) error

StageLoaded potentially sends a previously staged Loaded into the stream, and then stages its arguments into response.Loaded.

func StageStore

func StageStore(
	stream interface {
		Send(*TransactionRequest) error
	},
	request **TransactionRequest,
	binding int,
	packedKey []byte,
	packedValues []byte,
	doc json.RawMessage,
	exists bool,
) error

StageStore potentially sends a previously staged Store into the stream, and then stages its arguments into request.Store.

func TransactionResponseChannel

func TransactionResponseChannel(stream Driver_TransactionsClient) <-chan TransactionResponseError

TransactionResponseChannel spawns a goroutine which receives from the stream and sends responses into the returned channel, which is closed after the first encountered read error. As an optimization, it avoids this read loop if the stream is an in-process adapter.

func WriteAcknowledge

func WriteAcknowledge(
	stream interface {
		Send(*TransactionRequest) error
	},
	request **TransactionRequest,
) error

WriteAcknowledge writes an Acknowledge request into the stream.

func WriteAcknowledged

func WriteAcknowledged(
	stream interface {
		Send(*TransactionResponse) error
	},
	response **TransactionResponse,
) error

WriteAcknowledged writes an Acknowledged response to the stream.

func WriteCommit

func WriteCommit(
	stream interface {
		Send(*TransactionRequest) error
	},
	request **TransactionRequest,
) error

WriteCommit flushes a pending Store request, and sends a Commit request.

func WriteDriverCommitted

func WriteDriverCommitted(
	stream interface {
		Send(*TransactionResponse) error
	},
	response **TransactionResponse,
) error

WriteDriverCommitted writes a DriverCommitted response to the stream.

func WritePrepare

func WritePrepare(
	stream interface {
		Send(*TransactionRequest) error
	},
	request **TransactionRequest,
	checkpoint pc.Checkpoint,
) error

WritePrepare flushes a pending Load request, and sends a Prepare request with the provided Flow checkpoint.

func WritePrepared

func WritePrepared(
	stream interface {
		Send(*TransactionResponse) error
	},
	response **TransactionResponse,
	checkpoint pf.DriverCheckpoint,
) error

WritePrepared flushes a pending Loaded response, and sends a Prepared response with the provided driver checkpoint.

Types

type ApplyRequest

type ApplyRequest struct {
	// Materialization to be applied.
	Materialization *flow.MaterializationSpec `protobuf:"bytes,1,opt,name=materialization,proto3" json:"materialization,omitempty"`
	// Version of the MaterializationSpec being applied.
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// Is this Apply a dry-run? If so, no action is undertaken and Apply will
	// report only what would have happened.
	DryRun               bool     `protobuf:"varint,3,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ApplyRequest is the request type of the ApplyUpsert and ApplyDelete RPCs.

func (*ApplyRequest) Descriptor

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

func (*ApplyRequest) Marshal

func (m *ApplyRequest) Marshal() (dAtA []byte, err error)

func (*ApplyRequest) MarshalJSON

func (m *ApplyRequest) MarshalJSON() ([]byte, error)

func (*ApplyRequest) MarshalTo

func (m *ApplyRequest) MarshalTo(dAtA []byte) (int, error)

func (*ApplyRequest) MarshalToSizedBuffer

func (m *ApplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ApplyRequest) ProtoMessage

func (*ApplyRequest) ProtoMessage()

func (*ApplyRequest) ProtoSize

func (m *ApplyRequest) ProtoSize() (n int)

func (*ApplyRequest) Reset

func (m *ApplyRequest) Reset()

func (*ApplyRequest) String

func (m *ApplyRequest) String() string

func (*ApplyRequest) Unmarshal

func (m *ApplyRequest) Unmarshal(dAtA []byte) error

func (*ApplyRequest) UnmarshalJSON

func (m *ApplyRequest) UnmarshalJSON(b []byte) error

func (*ApplyRequest) Validate

func (m *ApplyRequest) Validate() error

Validate returns an error if the ApplyRequest is malformed.

func (*ApplyRequest) XXX_DiscardUnknown

func (m *ApplyRequest) XXX_DiscardUnknown()

func (*ApplyRequest) XXX_Marshal

func (m *ApplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ApplyRequest) XXX_Merge

func (m *ApplyRequest) XXX_Merge(src proto.Message)

func (*ApplyRequest) XXX_Size

func (m *ApplyRequest) XXX_Size() int

func (*ApplyRequest) XXX_Unmarshal

func (m *ApplyRequest) XXX_Unmarshal(b []byte) error

type ApplyResponse

type ApplyResponse struct {
	// Human-readable description of the action that the Driver took (or, if
	// dry_run, would have taken). If empty, this Apply is to be considered a
	// "no-op".
	ActionDescription    string   `protobuf:"bytes,1,opt,name=action_description,json=actionDescription,proto3" json:"action_description,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ApplyResponse is the response type of the ApplyUpsert and ApplyDelete RPCs.

func (*ApplyResponse) Descriptor

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

func (*ApplyResponse) Marshal

func (m *ApplyResponse) Marshal() (dAtA []byte, err error)

func (*ApplyResponse) MarshalJSON

func (m *ApplyResponse) MarshalJSON() ([]byte, error)

func (*ApplyResponse) MarshalTo

func (m *ApplyResponse) MarshalTo(dAtA []byte) (int, error)

func (*ApplyResponse) MarshalToSizedBuffer

func (m *ApplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ApplyResponse) ProtoMessage

func (*ApplyResponse) ProtoMessage()

func (*ApplyResponse) ProtoSize

func (m *ApplyResponse) ProtoSize() (n int)

func (*ApplyResponse) Reset

func (m *ApplyResponse) Reset()

func (*ApplyResponse) String

func (m *ApplyResponse) String() string

func (*ApplyResponse) Unmarshal

func (m *ApplyResponse) Unmarshal(dAtA []byte) error

func (*ApplyResponse) UnmarshalJSON

func (m *ApplyResponse) UnmarshalJSON(b []byte) error

func (*ApplyResponse) XXX_DiscardUnknown

func (m *ApplyResponse) XXX_DiscardUnknown()

func (*ApplyResponse) XXX_Marshal

func (m *ApplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ApplyResponse) XXX_Merge

func (m *ApplyResponse) XXX_Merge(src proto.Message)

func (*ApplyResponse) XXX_Size

func (m *ApplyResponse) XXX_Size() int

func (*ApplyResponse) XXX_Unmarshal

func (m *ApplyResponse) XXX_Unmarshal(b []byte) error

type CommitOps

type CommitOps struct {
	// DriverCommitted resolves on reading DriverCommitted of the prior transaction.
	// This operation is a depencency of a staged recovery log write, and its
	// resolution allows the recovery log commit to proceed.
	// Nil if there isn't an ongoing driver commit.
	DriverCommitted *client.AsyncOperation
	// LogCommitted resolves on the prior transactions's commit to the recovery log.
	// When resolved, the TxnClient notifies the driver by sending Acknowledge.
	// Nil if there isn't an ongoing recovery log commit.
	LogCommitted client.OpFuture
	// Acknowledged resolves on reading Acknowledged from the driver, and completes
	// the transaction lifecycle. Once resolved (and not before), a current and
	// concurrent may begin to commit (by sending Prepared).
	Acknowledged *client.AsyncOperation
}

CommitOps are operations which coordinate the mutual commit of a transaction between the Flow runtime and materialization driver.

type Constraint

type Constraint struct {
	Type Constraint_Type `protobuf:"varint,2,opt,name=type,proto3,enum=materialize.Constraint_Type" json:"type,omitempty"`
	// Optional human readable reason for the given constraint.
	// Implementations are strongly encouraged to supply a descriptive message.
	Reason               string   `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Constraint constrains the use of a flow.Projection within a materialization.

func (*Constraint) Descriptor

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

func (*Constraint) Marshal

func (m *Constraint) Marshal() (dAtA []byte, err error)

func (*Constraint) MarshalTo

func (m *Constraint) MarshalTo(dAtA []byte) (int, error)

func (*Constraint) MarshalToSizedBuffer

func (m *Constraint) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Constraint) ProtoMessage

func (*Constraint) ProtoMessage()

func (*Constraint) ProtoSize

func (m *Constraint) ProtoSize() (n int)

func (*Constraint) Reset

func (m *Constraint) Reset()

func (*Constraint) String

func (m *Constraint) String() string

func (*Constraint) Unmarshal

func (m *Constraint) Unmarshal(dAtA []byte) error

func (*Constraint) XXX_DiscardUnknown

func (m *Constraint) XXX_DiscardUnknown()

func (*Constraint) XXX_Marshal

func (m *Constraint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Constraint) XXX_Merge

func (m *Constraint) XXX_Merge(src proto.Message)

func (*Constraint) XXX_Size

func (m *Constraint) XXX_Size() int

func (*Constraint) XXX_Unmarshal

func (m *Constraint) XXX_Unmarshal(b []byte) error

type Constraint_Type

type Constraint_Type int32

Type encodes a constraint type for this flow.Projection.

const (
	// This specific projection must be present.
	Constraint_FIELD_REQUIRED Constraint_Type = 0
	// At least one projection with this location pointer must be present.
	Constraint_LOCATION_REQUIRED Constraint_Type = 1
	// A projection with this location is recommended, and should be included by
	// default.
	Constraint_LOCATION_RECOMMENDED Constraint_Type = 2
	// This projection may be included, but should be omitted by default.
	Constraint_FIELD_OPTIONAL Constraint_Type = 3
	// This projection must not be present in the materialization.
	Constraint_FIELD_FORBIDDEN Constraint_Type = 4
	// This specific projection is required but is also unacceptable (e.x.,
	// because it uses an incompatible type with a previous applied version).
	Constraint_UNSATISFIABLE Constraint_Type = 5
)

func (Constraint_Type) EnumDescriptor

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

func (*Constraint_Type) IsForbidden

func (m *Constraint_Type) IsForbidden() bool

IsForbidden returns true if the constraint type forbids inclusion in a materialization. This will return true for FIELD_FORBIDDEN and UNSATISFIABLE, and false for any other constraint type.

func (Constraint_Type) String

func (x Constraint_Type) String() string

type DriverClient

type DriverClient interface {
	// Spec returns the specification definition of this driver.
	// Notably this includes its endpoint and resource configuration JSON schema.
	Spec(ctx context.Context, in *SpecRequest, opts ...grpc.CallOption) (*SpecResponse, error)
	// Validate that store resources and proposed collection bindings are
	// compatible, and return constraints over the projections of each binding.
	Validate(ctx context.Context, in *ValidateRequest, opts ...grpc.CallOption) (*ValidateResponse, error)
	// ApplyUpsert applies a new or updated materialization to the store.
	ApplyUpsert(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error)
	// ApplyDelete deletes an existing materialization from the store.
	ApplyDelete(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error)
	// Transactions is a very long lived RPC through which the Flow runtime and a
	// Driver cooperatively execute an unbounded number of transactions.
	//
	// This RPC workflow maintains a materialized view of a Flow collection
	// in an external system. It has distinct load, prepare, store, and commit
	// phases. The Flow runtime and driver cooperatively maintain a fully-reduced
	// view of each document by loading current states from the store, reducing in
	// a number of updates, and then transactionally storing updated documents and
	// checkpoints.
	//
	// Push-only Endpoints & Delta Updates
	// ===================================
	//
	// Some systems, such as APIs, Webhooks, and Pub/Sub, are push-only in nature.
	// Flow materializations can run in a "delta updates" mode, where the load
	// phase is always skipped and Flow does not attempt to store fully-reduced
	// documents. Instead, during the store phase, the runtime sends delta
	// updates which reflect the combined roll-up of collection documents
	// processed only within this transaction.
	//
	// To illustrate the meaning of a delta update, consider documents which are
	// simple counters, having a collection schema that uses a `sum` reduction
	// strategy.
	//
	// Without delta updates, Flow would reduce documents -1, 3, and 2 by `sum`
	// to arrive at document 4, which is stored. The next transaction,
	// document 4 is loaded and reduced with 6, -7, and -1 to arrive at a new
	// stored document 2. This document, 2, represents the full reduction of the
	// collection documents materialized thus far.
	//
	// Compare to delta updates mode: collection documents -1, 3, and 2 are
	// combined to store a delta-update document of 4. The next transaction starts
	// anew, and 6, -7, and -1 combine to arrive at a delta-update document of -2.
	// These delta updates are a windowed combine over documents seen in the
	// current transaction only, and unlike before are not a full reduction of the
	// document. If delta updates were written to pub/sub, note that a subscriber
	// could further reduce over each delta update to recover the fully reduced
	// document of 2.
	//
	// Note that many use cases require only `lastWriteWins` reduction behavior,
	// and for these use cases delta updates does the "right thing" by trivially
	// re-writing each document with its most recent version. This matches the
	// behavior of Kafka Connect, for example.
	//
	// On Transactionality
	// ===================
	//
	// The beating heart of transactionality in materializations is this:
	// there is a consumption checkpoint, and there is a state of the view.
	// As the materialization progresses, both the checkpoint and the view state
	// will change. Updates to the checkpoint and to the view state MUST always
	// commit together, in the exact same transaction.
	//
	// Flow transaction tasks have a backing transactional recovery log,
	// which is capable of durable commits that update both the checkpoint
	// and also a (reasonably small) driver-defined state. More on driver
	// states later.
	//
	// Many interesting systems are also fully transactional in nature.
	//
	// When implementing a matherialization driver, the first question an
	// implementor must answer is: whose commit is authoritative?
	// Flow's recovery log, or the materialized system ?
	// This protocol supports either.
	//
	// Implementation Pattern: Remote Store is Authoritative
	// =====================================================
	//
	// In this pattern, the remote store persists view states and the Flow
	// consumption checkpoints which those views reflect (there are many such
	// checkpoints: one per task split). The Flow recovery log is not used.
	//
	// Typically this workflow runs in the context of a synchronous BEGIN/COMMIT
	// transaction, which updates table states and a Flow checkpoint together.
	// The transaction need be scoped only to the store phase of this workflow,
	// as the Flow runtime assumes only read-committed loads.
	//
	// Flow is a distributed system, and an important consideration is the effect
	// of a "zombie" assignment of a materialization task, which can race a
	// newly-promoted assignment of that same task.
	//
	// Fencing is a technique which uses the transactional capabilities of a store
	// to "fence off" an older zombie assignment, such that it's prevented from
	// committing further transactions. This avoids a failure mode where:
	//  - New assignment N recovers a checkpoint at Ti.
	//  - Zombie assignment Z commits another transaction at Ti+1.
	//  - N beings processing from Ti, inadvertently duplicating the effects of
	//  Ti+1.
	//
	// When authoritative, the remote store must implement fencing behavior.
	// As a sketch, the store can maintain a nonce value alongside the checkpoint
	// of each task split. The nonce is updated on each open of this RPC,
	// and each commit transaction then verifies that the nonce has not been
	// changed.
	//
	// In the future, if another RPC opens and updates the nonce, it fences off
	// this instance of the task split and prevents it from committing further
	// transactions.
	//
	// Implementation Pattern: Recovery Log with Non-Transactional Store
	// =================================================================
	//
	// In this pattern, the recovery log persists the Flow checkpoint and handles
	// fencing semantics. During the load and store phases, the driver
	// directly manipulates a non-transactional store or API.
	//
	// Note that this pattern is at-least-once. A transaction may fail part-way
	// through and be restarted, causing its effects to be partially or fully
	// replayed.
	//
	// Care must be taken if the collection's schema has reduction annotations
	// such as `sum`, as those reductions may be applied more than once due to
	// a partially completed, but ultimately failed transaction.
	//
	// If the collection's schema is last-write-wins, this mode still provides
	// effectively-once behavior. Collections which aren't last-write-wins
	// can be turned into last-write-wins through the use of derivation
	// registers.
	//
	// Implementation Pattern: Recovery Log with Idempotent Apply
	// ==========================================================
	//
	// In this pattern the recovery log is authoritative, but the driver uses
	// external stable storage to stage the effects of a transaction -- rather
	// than directly applying them to the store -- such that those effects can be
	// idempotently applied after the transaction commits.
	//
	// This allows stores which feature a weaker transactionality guarantee to
	// still be used in an exactly-once way, so long as they support an idempotent
	// apply operation.
	//
	// Driver checkpoints can facilitate this pattern. For example, a driver might
	// generate a unique filename in S3 and reference it in its prepared
	// checkpoint, which is committed to the recovery log. During the "store"
	// phase, it writes to this S3 file. After the transaction commits, it tells
	// the store of the new file to incorporate. The store must handle
	// idempotency, by applying the effects of the unique file just once, even if
	// told of the file multiple times.
	//
	// A related extension of this pattern is for the driver to embed a Flow
	// checkpoint into its driver checkpoint. Doing so allows the driver to
	// express an intention to restart from an older alternative checkpoint, as
	// compared to the most recent committed checkpoint of the recovery log.
	//
	// As mentioned above, it's crucial that store states and checkpoints commit
	// together. While seemingly bending that rule, this pattern is consistent
	// with it because, on commit, the semantic contents of the store include BOTH
	// its base state, as well as the staged idempotent update. The store just may
	// not know it yet, but eventually it must because of the retried idempotent
	// apply.
	//
	// Note the driver must therefore ensure that staged updates are fully applied
	// before returning an "load" responses, in order to provide the correct
	// read-committed semantics required by the Flow runtime.
	//
	// RPC Lifecycle
	// =============
	//
	// The RPC follows the following lifecycle:
	//
	// :TransactionRequest.Open:
	//    - The Flow runtime opens the stream.
	// :TransactionResponse.Opened:
	//    - If the remote store is authoritative, it must fence off other RPCs
	//      of this task split from committing further transactions,
	//      and it retrieves a Flow checkpoint which is returned to the runtime.
	//
	// TransactionRequest.Open and TransactionResponse.Opened are sent only
	// once, at the commencement of the stream. Thereafter the protocol loops:
	//
	// Load phase
	// ==========
	//
	// The Load phases is Load requests *intermixed* with one
	// Acknowledge/Acknowledged message flow. The driver must accomodate an
	// Acknowledge that occurs before, during, or after a sequence of Load
	// requests. It's guaranteed to see exactly one Acknowledge request during
	// this phase.
	//
	// :TransactionRequest.Acknowledge:
	//    - The runtime tells the driver that a commit to the recovery log has
	//      completed.
	//    - The driver applies a staged update to the base store, where
	//      applicable.
	//    - Note Acknowledge is sent in the very first iteration for consistency.
	//      Semantically, it's an acknowledgement of the recovered checkpoint.
	//      If a previous invocation failed after recovery log commit but before
	//      applying the staged change, this is an opportunity to ensure that
	//      apply occurs.
	// :TransactionResponse.Acknowledged:
	//    - The driver responds to the runtime only after applying a staged
	//      update, where applicable.
	//    - If there is no staged update, the driver immediately responds on
	//      seeing Acknowledge.
	//
	// :TransactionRequest.Load:
	//    - The runtime sends zero or more Load messages.
	//    - The driver may send any number of TransactionResponse.Loaded in
	//      response.
	//    - If the driver will apply a staged update, it must await Acknowledge
	//      and have applied the update to the store *before* evaluating any
	//      Loads, to ensure correct read-committed behavior.
	//    - The driver may defer responding with some or all loads until the
	//      prepare phase.
	// :TransactionResponse.Loaded:
	//    - The driver sends zero or more Loaded messages, once for each loaded
	//      document.
	//    - Document keys not found in the store are omitted and not sent as
	//      Loaded.
	//
	// Prepare phase
	// =============
	//
	// The prepare phase begins only after the prior transaction has both
	// committed and also been acknowledged. It marks the bounds of the present
	// transaction.
	//
	// Upon entering this phase, the driver must immediately evaluate any deferred
	// Load requests and send remaining Loaded responses.
	//
	// :TransactionRequest.Prepare:
	//    - The runtime sends a Prepare message with its Flow checkpoint.
	// :TransactionResponse.Prepared:
	//    - The driver sends Prepared after having flushed all Loaded responses.
	//    - The driver may include a driver checkpoint update which will be
	//      committed to the recovery log with this transaction.
	//
	// Store phase
	// ===========
	//
	// The store phase is when the runtime sends the driver materialized document
	// updates, as well as an indication of whether the document is an insert,
	// update, or delete (in other words, was it returned in a Loaded response?).
	//
	// :TransactionRequest.Store:
	//    - The runtime sends zero or more Store messages.
	//
	// Commit phase
	// ============
	//
	// The commit phase marks the end of the store phase, and tells the driver of
	// the runtime's intent to commit to its recovery log. If the remote store is
	// authoritative, the driver must commit its transaction at this time.
	//
	// :TransactionRequest.Commit:
	//    - The runtime sends a Commit message, denoting its intention to commit.
	//    - If the remote store is authoritative, the driver includes the Flow
	//      checkpoint into its transaction and commits it along with view state
	//      updates.
	//    - Otherwise, the driver immediately responds with DriverCommitted.
	// :TransactionResponse.DriverCommitted:
	//    - The driver sends a DriverCommitted message.
	//    - The runtime commits Flow and driver checkpoint to its recovery
	//      log. The completion of this commit will be marked by an
	//      Acknowledge during the next load phase.
	//    - Runtime and driver begin a new, pipelined transaction by looping to
	//      load while this transaction continues to commit.
	//
	// An error of any kind rolls back the transaction in progress and terminates
	// the stream.
	Transactions(ctx context.Context, opts ...grpc.CallOption) (Driver_TransactionsClient, error)
}

DriverClient is the client API for Driver service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func AdaptServerToClient

func AdaptServerToClient(srv DriverServer) DriverClient

AdaptServerToClient wraps an in-process DriverServer to provide a DriverClient.

func NewDriverClient

func NewDriverClient(cc *grpc.ClientConn) DriverClient

type DriverServer

type DriverServer interface {
	// Spec returns the specification definition of this driver.
	// Notably this includes its endpoint and resource configuration JSON schema.
	Spec(context.Context, *SpecRequest) (*SpecResponse, error)
	// Validate that store resources and proposed collection bindings are
	// compatible, and return constraints over the projections of each binding.
	Validate(context.Context, *ValidateRequest) (*ValidateResponse, error)
	// ApplyUpsert applies a new or updated materialization to the store.
	ApplyUpsert(context.Context, *ApplyRequest) (*ApplyResponse, error)
	// ApplyDelete deletes an existing materialization from the store.
	ApplyDelete(context.Context, *ApplyRequest) (*ApplyResponse, error)
	// Transactions is a very long lived RPC through which the Flow runtime and a
	// Driver cooperatively execute an unbounded number of transactions.
	//
	// This RPC workflow maintains a materialized view of a Flow collection
	// in an external system. It has distinct load, prepare, store, and commit
	// phases. The Flow runtime and driver cooperatively maintain a fully-reduced
	// view of each document by loading current states from the store, reducing in
	// a number of updates, and then transactionally storing updated documents and
	// checkpoints.
	//
	// Push-only Endpoints & Delta Updates
	// ===================================
	//
	// Some systems, such as APIs, Webhooks, and Pub/Sub, are push-only in nature.
	// Flow materializations can run in a "delta updates" mode, where the load
	// phase is always skipped and Flow does not attempt to store fully-reduced
	// documents. Instead, during the store phase, the runtime sends delta
	// updates which reflect the combined roll-up of collection documents
	// processed only within this transaction.
	//
	// To illustrate the meaning of a delta update, consider documents which are
	// simple counters, having a collection schema that uses a `sum` reduction
	// strategy.
	//
	// Without delta updates, Flow would reduce documents -1, 3, and 2 by `sum`
	// to arrive at document 4, which is stored. The next transaction,
	// document 4 is loaded and reduced with 6, -7, and -1 to arrive at a new
	// stored document 2. This document, 2, represents the full reduction of the
	// collection documents materialized thus far.
	//
	// Compare to delta updates mode: collection documents -1, 3, and 2 are
	// combined to store a delta-update document of 4. The next transaction starts
	// anew, and 6, -7, and -1 combine to arrive at a delta-update document of -2.
	// These delta updates are a windowed combine over documents seen in the
	// current transaction only, and unlike before are not a full reduction of the
	// document. If delta updates were written to pub/sub, note that a subscriber
	// could further reduce over each delta update to recover the fully reduced
	// document of 2.
	//
	// Note that many use cases require only `lastWriteWins` reduction behavior,
	// and for these use cases delta updates does the "right thing" by trivially
	// re-writing each document with its most recent version. This matches the
	// behavior of Kafka Connect, for example.
	//
	// On Transactionality
	// ===================
	//
	// The beating heart of transactionality in materializations is this:
	// there is a consumption checkpoint, and there is a state of the view.
	// As the materialization progresses, both the checkpoint and the view state
	// will change. Updates to the checkpoint and to the view state MUST always
	// commit together, in the exact same transaction.
	//
	// Flow transaction tasks have a backing transactional recovery log,
	// which is capable of durable commits that update both the checkpoint
	// and also a (reasonably small) driver-defined state. More on driver
	// states later.
	//
	// Many interesting systems are also fully transactional in nature.
	//
	// When implementing a matherialization driver, the first question an
	// implementor must answer is: whose commit is authoritative?
	// Flow's recovery log, or the materialized system ?
	// This protocol supports either.
	//
	// Implementation Pattern: Remote Store is Authoritative
	// =====================================================
	//
	// In this pattern, the remote store persists view states and the Flow
	// consumption checkpoints which those views reflect (there are many such
	// checkpoints: one per task split). The Flow recovery log is not used.
	//
	// Typically this workflow runs in the context of a synchronous BEGIN/COMMIT
	// transaction, which updates table states and a Flow checkpoint together.
	// The transaction need be scoped only to the store phase of this workflow,
	// as the Flow runtime assumes only read-committed loads.
	//
	// Flow is a distributed system, and an important consideration is the effect
	// of a "zombie" assignment of a materialization task, which can race a
	// newly-promoted assignment of that same task.
	//
	// Fencing is a technique which uses the transactional capabilities of a store
	// to "fence off" an older zombie assignment, such that it's prevented from
	// committing further transactions. This avoids a failure mode where:
	//  - New assignment N recovers a checkpoint at Ti.
	//  - Zombie assignment Z commits another transaction at Ti+1.
	//  - N beings processing from Ti, inadvertently duplicating the effects of
	//  Ti+1.
	//
	// When authoritative, the remote store must implement fencing behavior.
	// As a sketch, the store can maintain a nonce value alongside the checkpoint
	// of each task split. The nonce is updated on each open of this RPC,
	// and each commit transaction then verifies that the nonce has not been
	// changed.
	//
	// In the future, if another RPC opens and updates the nonce, it fences off
	// this instance of the task split and prevents it from committing further
	// transactions.
	//
	// Implementation Pattern: Recovery Log with Non-Transactional Store
	// =================================================================
	//
	// In this pattern, the recovery log persists the Flow checkpoint and handles
	// fencing semantics. During the load and store phases, the driver
	// directly manipulates a non-transactional store or API.
	//
	// Note that this pattern is at-least-once. A transaction may fail part-way
	// through and be restarted, causing its effects to be partially or fully
	// replayed.
	//
	// Care must be taken if the collection's schema has reduction annotations
	// such as `sum`, as those reductions may be applied more than once due to
	// a partially completed, but ultimately failed transaction.
	//
	// If the collection's schema is last-write-wins, this mode still provides
	// effectively-once behavior. Collections which aren't last-write-wins
	// can be turned into last-write-wins through the use of derivation
	// registers.
	//
	// Implementation Pattern: Recovery Log with Idempotent Apply
	// ==========================================================
	//
	// In this pattern the recovery log is authoritative, but the driver uses
	// external stable storage to stage the effects of a transaction -- rather
	// than directly applying them to the store -- such that those effects can be
	// idempotently applied after the transaction commits.
	//
	// This allows stores which feature a weaker transactionality guarantee to
	// still be used in an exactly-once way, so long as they support an idempotent
	// apply operation.
	//
	// Driver checkpoints can facilitate this pattern. For example, a driver might
	// generate a unique filename in S3 and reference it in its prepared
	// checkpoint, which is committed to the recovery log. During the "store"
	// phase, it writes to this S3 file. After the transaction commits, it tells
	// the store of the new file to incorporate. The store must handle
	// idempotency, by applying the effects of the unique file just once, even if
	// told of the file multiple times.
	//
	// A related extension of this pattern is for the driver to embed a Flow
	// checkpoint into its driver checkpoint. Doing so allows the driver to
	// express an intention to restart from an older alternative checkpoint, as
	// compared to the most recent committed checkpoint of the recovery log.
	//
	// As mentioned above, it's crucial that store states and checkpoints commit
	// together. While seemingly bending that rule, this pattern is consistent
	// with it because, on commit, the semantic contents of the store include BOTH
	// its base state, as well as the staged idempotent update. The store just may
	// not know it yet, but eventually it must because of the retried idempotent
	// apply.
	//
	// Note the driver must therefore ensure that staged updates are fully applied
	// before returning an "load" responses, in order to provide the correct
	// read-committed semantics required by the Flow runtime.
	//
	// RPC Lifecycle
	// =============
	//
	// The RPC follows the following lifecycle:
	//
	// :TransactionRequest.Open:
	//    - The Flow runtime opens the stream.
	// :TransactionResponse.Opened:
	//    - If the remote store is authoritative, it must fence off other RPCs
	//      of this task split from committing further transactions,
	//      and it retrieves a Flow checkpoint which is returned to the runtime.
	//
	// TransactionRequest.Open and TransactionResponse.Opened are sent only
	// once, at the commencement of the stream. Thereafter the protocol loops:
	//
	// Load phase
	// ==========
	//
	// The Load phases is Load requests *intermixed* with one
	// Acknowledge/Acknowledged message flow. The driver must accomodate an
	// Acknowledge that occurs before, during, or after a sequence of Load
	// requests. It's guaranteed to see exactly one Acknowledge request during
	// this phase.
	//
	// :TransactionRequest.Acknowledge:
	//    - The runtime tells the driver that a commit to the recovery log has
	//      completed.
	//    - The driver applies a staged update to the base store, where
	//      applicable.
	//    - Note Acknowledge is sent in the very first iteration for consistency.
	//      Semantically, it's an acknowledgement of the recovered checkpoint.
	//      If a previous invocation failed after recovery log commit but before
	//      applying the staged change, this is an opportunity to ensure that
	//      apply occurs.
	// :TransactionResponse.Acknowledged:
	//    - The driver responds to the runtime only after applying a staged
	//      update, where applicable.
	//    - If there is no staged update, the driver immediately responds on
	//      seeing Acknowledge.
	//
	// :TransactionRequest.Load:
	//    - The runtime sends zero or more Load messages.
	//    - The driver may send any number of TransactionResponse.Loaded in
	//      response.
	//    - If the driver will apply a staged update, it must await Acknowledge
	//      and have applied the update to the store *before* evaluating any
	//      Loads, to ensure correct read-committed behavior.
	//    - The driver may defer responding with some or all loads until the
	//      prepare phase.
	// :TransactionResponse.Loaded:
	//    - The driver sends zero or more Loaded messages, once for each loaded
	//      document.
	//    - Document keys not found in the store are omitted and not sent as
	//      Loaded.
	//
	// Prepare phase
	// =============
	//
	// The prepare phase begins only after the prior transaction has both
	// committed and also been acknowledged. It marks the bounds of the present
	// transaction.
	//
	// Upon entering this phase, the driver must immediately evaluate any deferred
	// Load requests and send remaining Loaded responses.
	//
	// :TransactionRequest.Prepare:
	//    - The runtime sends a Prepare message with its Flow checkpoint.
	// :TransactionResponse.Prepared:
	//    - The driver sends Prepared after having flushed all Loaded responses.
	//    - The driver may include a driver checkpoint update which will be
	//      committed to the recovery log with this transaction.
	//
	// Store phase
	// ===========
	//
	// The store phase is when the runtime sends the driver materialized document
	// updates, as well as an indication of whether the document is an insert,
	// update, or delete (in other words, was it returned in a Loaded response?).
	//
	// :TransactionRequest.Store:
	//    - The runtime sends zero or more Store messages.
	//
	// Commit phase
	// ============
	//
	// The commit phase marks the end of the store phase, and tells the driver of
	// the runtime's intent to commit to its recovery log. If the remote store is
	// authoritative, the driver must commit its transaction at this time.
	//
	// :TransactionRequest.Commit:
	//    - The runtime sends a Commit message, denoting its intention to commit.
	//    - If the remote store is authoritative, the driver includes the Flow
	//      checkpoint into its transaction and commits it along with view state
	//      updates.
	//    - Otherwise, the driver immediately responds with DriverCommitted.
	// :TransactionResponse.DriverCommitted:
	//    - The driver sends a DriverCommitted message.
	//    - The runtime commits Flow and driver checkpoint to its recovery
	//      log. The completion of this commit will be marked by an
	//      Acknowledge during the next load phase.
	//    - Runtime and driver begin a new, pipelined transaction by looping to
	//      load while this transaction continues to commit.
	//
	// An error of any kind rolls back the transaction in progress and terminates
	// the stream.
	Transactions(Driver_TransactionsServer) error
}

DriverServer is the server API for Driver service.

type Driver_TransactionsClient

type Driver_TransactionsClient interface {
	Send(*TransactionRequest) error
	Recv() (*TransactionResponse, error)
	grpc.ClientStream
}

type Driver_TransactionsServer

type Driver_TransactionsServer interface {
	Send(*TransactionResponse) error
	Recv() (*TransactionRequest, error)
	grpc.ServerStream
}

type LoadIterator

type LoadIterator struct {
	Binding int         // Binding index of this document to load.
	Key     tuple.Tuple // Key of the next document to load.
	// contains filtered or unexported fields
}

LoadIterator is an iterator over Load requests.

func NewLoadIterator

func NewLoadIterator(stream Driver_TransactionsServer, reqAckCh chan<- struct{}) *LoadIterator

NewLoadIterator returns a *LoadIterator of the stream.

func (*LoadIterator) Context

func (it *LoadIterator) Context() context.Context

Context returns the Context of this LoadIterator.

func (*LoadIterator) Err

func (it *LoadIterator) Err() error

Err returns an encountered error.

func (*LoadIterator) Next

func (it *LoadIterator) Next() bool

Next returns true if there is another Load and makes it available via Key. When a Prepare is read, or if an error is encountered, it returns false and must not be called again.

func (*LoadIterator) Prepare

Prepare returns a TransactionRequest_Prepare which caused this LoadIterator to terminate. It's valid only after Next returns false and Err is nil.

type SpecRequest

type SpecRequest struct {
	// Endpoint type addressed by this request.
	EndpointType flow.EndpointType `protobuf:"varint,1,opt,name=endpoint_type,json=endpointType,proto3,enum=flow.EndpointType" json:"endpoint_type,omitempty"`
	// Driver specification, as an encoded JSON object.
	// This may be a partial specification (for example, a Docker image),
	// providing only enough information to fetch the remainder of the
	// specification schema.
	EndpointSpecJson     encoding_json.RawMessage `` /* 141-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                 `json:"-"`
	XXX_unrecognized     []byte                   `json:"-"`
	XXX_sizecache        int32                    `json:"-"`
}

SpecRequest is the request type of the Spec RPC.

func (*SpecRequest) Descriptor

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

func (*SpecRequest) Marshal

func (m *SpecRequest) Marshal() (dAtA []byte, err error)

func (*SpecRequest) MarshalTo

func (m *SpecRequest) MarshalTo(dAtA []byte) (int, error)

func (*SpecRequest) MarshalToSizedBuffer

func (m *SpecRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SpecRequest) ProtoMessage

func (*SpecRequest) ProtoMessage()

func (*SpecRequest) ProtoSize

func (m *SpecRequest) ProtoSize() (n int)

func (*SpecRequest) Reset

func (m *SpecRequest) Reset()

func (*SpecRequest) String

func (m *SpecRequest) String() string

func (*SpecRequest) Unmarshal

func (m *SpecRequest) Unmarshal(dAtA []byte) error

func (*SpecRequest) Validate

func (m *SpecRequest) Validate() error

Validate returns an error if the SpecRequest isn't well-formed.

func (*SpecRequest) XXX_DiscardUnknown

func (m *SpecRequest) XXX_DiscardUnknown()

func (*SpecRequest) XXX_Marshal

func (m *SpecRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SpecRequest) XXX_Merge

func (m *SpecRequest) XXX_Merge(src proto.Message)

func (*SpecRequest) XXX_Size

func (m *SpecRequest) XXX_Size() int

func (*SpecRequest) XXX_Unmarshal

func (m *SpecRequest) XXX_Unmarshal(b []byte) error

type SpecResponse

type SpecResponse struct {
	// JSON schema of an endpoint specification.
	EndpointSpecSchemaJson encoding_json.RawMessage `` /* 161-byte string literal not displayed */
	// JSON schema of a resource specification.
	ResourceSpecSchemaJson encoding_json.RawMessage `` /* 161-byte string literal not displayed */
	// URL for connector's documention.
	DocumentationUrl     string   `protobuf:"bytes,3,opt,name=documentation_url,json=documentationUrl,proto3" json:"documentation_url,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

SpecResponse is the response type of the Spec RPC.

func (*SpecResponse) Descriptor

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

func (*SpecResponse) Marshal

func (m *SpecResponse) Marshal() (dAtA []byte, err error)

func (*SpecResponse) MarshalTo

func (m *SpecResponse) MarshalTo(dAtA []byte) (int, error)

func (*SpecResponse) MarshalToSizedBuffer

func (m *SpecResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SpecResponse) ProtoMessage

func (*SpecResponse) ProtoMessage()

func (*SpecResponse) ProtoSize

func (m *SpecResponse) ProtoSize() (n int)

func (*SpecResponse) Reset

func (m *SpecResponse) Reset()

func (*SpecResponse) String

func (m *SpecResponse) String() string

func (*SpecResponse) Unmarshal

func (m *SpecResponse) Unmarshal(dAtA []byte) error

func (*SpecResponse) Validate

func (m *SpecResponse) Validate() error

Validate returns an error if the SpecResponse isn't well-formed.

func (*SpecResponse) XXX_DiscardUnknown

func (m *SpecResponse) XXX_DiscardUnknown()

func (*SpecResponse) XXX_Marshal

func (m *SpecResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SpecResponse) XXX_Merge

func (m *SpecResponse) XXX_Merge(src proto.Message)

func (*SpecResponse) XXX_Size

func (m *SpecResponse) XXX_Size() int

func (*SpecResponse) XXX_Unmarshal

func (m *SpecResponse) XXX_Unmarshal(b []byte) error

type StoreIterator

type StoreIterator struct {
	Binding int             // Binding index of this stored document.
	Key     tuple.Tuple     // Key of the next document to store.
	Values  tuple.Tuple     // Values of the next document to store.
	RawJSON json.RawMessage // Document to store.
	Exists  bool            // Does this document exist in the store already?
	// contains filtered or unexported fields
}

StoreIterator is an iterator over Store requests.

func NewStoreIterator

func NewStoreIterator(stream Driver_TransactionsServer) *StoreIterator

NewStoreIterator returns a *StoreIterator of the stream.

func (*StoreIterator) Commit

Commit returns a TransactionRequest_Commit which caused this StoreIterator to terminate. It's valid only after Next returns false and Err is nil.

func (*StoreIterator) Context

func (it *StoreIterator) Context() context.Context

Context returns the Context of this StoreIterator.

func (*StoreIterator) Err

func (it *StoreIterator) Err() error

Err returns an encountered error.

func (*StoreIterator) Next

func (it *StoreIterator) Next() bool

Next returns true if there is another Store and makes it available. When a Commit is read, or if an error is encountered, it returns false and must not be called again.

type TransactionRequest

type TransactionRequest struct {
	Open                 *TransactionRequest_Open        `protobuf:"bytes,1,opt,name=open,proto3" json:"open,omitempty"`
	Load                 *TransactionRequest_Load        `protobuf:"bytes,2,opt,name=load,proto3" json:"load,omitempty"`
	Prepare              *TransactionRequest_Prepare     `protobuf:"bytes,3,opt,name=prepare,proto3" json:"prepare,omitempty"`
	Store                *TransactionRequest_Store       `protobuf:"bytes,4,opt,name=store,proto3" json:"store,omitempty"`
	Commit               *TransactionRequest_Commit      `protobuf:"bytes,5,opt,name=commit,proto3" json:"commit,omitempty"`
	Acknowledge          *TransactionRequest_Acknowledge `protobuf:"bytes,6,opt,name=acknowledge,proto3" json:"acknowledge,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                        `json:"-"`
	XXX_unrecognized     []byte                          `json:"-"`
	XXX_sizecache        int32                           `json:"-"`
}

TransactionRequest is the request type of a Transaction RPC. It will have exactly one top-level field set, which represents its message type.

func (*TransactionRequest) Descriptor

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

func (*TransactionRequest) Marshal

func (m *TransactionRequest) Marshal() (dAtA []byte, err error)

func (*TransactionRequest) MarshalTo

func (m *TransactionRequest) MarshalTo(dAtA []byte) (int, error)

func (*TransactionRequest) MarshalToSizedBuffer

func (m *TransactionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionRequest) ProtoMessage

func (*TransactionRequest) ProtoMessage()

func (*TransactionRequest) ProtoSize

func (m *TransactionRequest) ProtoSize() (n int)

func (*TransactionRequest) Reset

func (m *TransactionRequest) Reset()

func (*TransactionRequest) String

func (m *TransactionRequest) String() string

func (*TransactionRequest) Unmarshal

func (m *TransactionRequest) Unmarshal(dAtA []byte) error

func (*TransactionRequest) Validate

func (m *TransactionRequest) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionRequest) XXX_DiscardUnknown

func (m *TransactionRequest) XXX_DiscardUnknown()

func (*TransactionRequest) XXX_Marshal

func (m *TransactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionRequest) XXX_Merge

func (m *TransactionRequest) XXX_Merge(src proto.Message)

func (*TransactionRequest) XXX_Size

func (m *TransactionRequest) XXX_Size() int

func (*TransactionRequest) XXX_Unmarshal

func (m *TransactionRequest) XXX_Unmarshal(b []byte) error

type TransactionRequest_Acknowledge

type TransactionRequest_Acknowledge struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Notify the driver that the previous transaction has committed to the Flow runtime's recovery log.

func (*TransactionRequest_Acknowledge) Descriptor

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

func (*TransactionRequest_Acknowledge) Marshal

func (m *TransactionRequest_Acknowledge) Marshal() (dAtA []byte, err error)

func (*TransactionRequest_Acknowledge) MarshalTo

func (m *TransactionRequest_Acknowledge) MarshalTo(dAtA []byte) (int, error)

func (*TransactionRequest_Acknowledge) MarshalToSizedBuffer

func (m *TransactionRequest_Acknowledge) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionRequest_Acknowledge) ProtoMessage

func (*TransactionRequest_Acknowledge) ProtoMessage()

func (*TransactionRequest_Acknowledge) ProtoSize

func (m *TransactionRequest_Acknowledge) ProtoSize() (n int)

func (*TransactionRequest_Acknowledge) Reset

func (m *TransactionRequest_Acknowledge) Reset()

func (*TransactionRequest_Acknowledge) String

func (*TransactionRequest_Acknowledge) Unmarshal

func (m *TransactionRequest_Acknowledge) Unmarshal(dAtA []byte) error

func (*TransactionRequest_Acknowledge) Validate

func (m *TransactionRequest_Acknowledge) Validate() error

Validate is a no-op.

func (*TransactionRequest_Acknowledge) XXX_DiscardUnknown

func (m *TransactionRequest_Acknowledge) XXX_DiscardUnknown()

func (*TransactionRequest_Acknowledge) XXX_Marshal

func (m *TransactionRequest_Acknowledge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionRequest_Acknowledge) XXX_Merge

func (m *TransactionRequest_Acknowledge) XXX_Merge(src proto.Message)

func (*TransactionRequest_Acknowledge) XXX_Size

func (m *TransactionRequest_Acknowledge) XXX_Size() int

func (*TransactionRequest_Acknowledge) XXX_Unmarshal

func (m *TransactionRequest_Acknowledge) XXX_Unmarshal(b []byte) error

type TransactionRequest_Commit

type TransactionRequest_Commit struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Mark the end of the Store phase, and if the remote store is authoritative, instruct it to commit its transaction.

func (*TransactionRequest_Commit) Descriptor

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

func (*TransactionRequest_Commit) Marshal

func (m *TransactionRequest_Commit) Marshal() (dAtA []byte, err error)

func (*TransactionRequest_Commit) MarshalTo

func (m *TransactionRequest_Commit) MarshalTo(dAtA []byte) (int, error)

func (*TransactionRequest_Commit) MarshalToSizedBuffer

func (m *TransactionRequest_Commit) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionRequest_Commit) ProtoMessage

func (*TransactionRequest_Commit) ProtoMessage()

func (*TransactionRequest_Commit) ProtoSize

func (m *TransactionRequest_Commit) ProtoSize() (n int)

func (*TransactionRequest_Commit) Reset

func (m *TransactionRequest_Commit) Reset()

func (*TransactionRequest_Commit) String

func (m *TransactionRequest_Commit) String() string

func (*TransactionRequest_Commit) Unmarshal

func (m *TransactionRequest_Commit) Unmarshal(dAtA []byte) error

func (*TransactionRequest_Commit) Validate

func (m *TransactionRequest_Commit) Validate() error

Validate is a no-op.

func (*TransactionRequest_Commit) XXX_DiscardUnknown

func (m *TransactionRequest_Commit) XXX_DiscardUnknown()

func (*TransactionRequest_Commit) XXX_Marshal

func (m *TransactionRequest_Commit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionRequest_Commit) XXX_Merge

func (m *TransactionRequest_Commit) XXX_Merge(src proto.Message)

func (*TransactionRequest_Commit) XXX_Size

func (m *TransactionRequest_Commit) XXX_Size() int

func (*TransactionRequest_Commit) XXX_Unmarshal

func (m *TransactionRequest_Commit) XXX_Unmarshal(b []byte) error

type TransactionRequest_Load

type TransactionRequest_Load struct {
	// The materialization binding for documents of this Load request.
	Binding uint32 `protobuf:"varint,1,opt,name=binding,proto3" json:"binding,omitempty"`
	// Byte arena of the request.
	Arena github_com_estuary_protocols_flow.Arena `protobuf:"bytes,2,opt,name=arena,proto3,casttype=github.com/estuary/protocols/flow.Arena" json:"arena,omitempty"`
	// Packed tuples of collection keys, enumerating the documents to load.
	PackedKeys           []flow.Slice `protobuf:"bytes,3,rep,name=packed_keys,json=packedKeys,proto3" json:"packed_keys"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

Load one or more documents identified by key. Keys may included documents which have never before been stored, but a given key will be sent in a transaction Load just one time.

func (*TransactionRequest_Load) Descriptor

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

func (*TransactionRequest_Load) Marshal

func (m *TransactionRequest_Load) Marshal() (dAtA []byte, err error)

func (*TransactionRequest_Load) MarshalTo

func (m *TransactionRequest_Load) MarshalTo(dAtA []byte) (int, error)

func (*TransactionRequest_Load) MarshalToSizedBuffer

func (m *TransactionRequest_Load) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionRequest_Load) ProtoMessage

func (*TransactionRequest_Load) ProtoMessage()

func (*TransactionRequest_Load) ProtoSize

func (m *TransactionRequest_Load) ProtoSize() (n int)

func (*TransactionRequest_Load) Reset

func (m *TransactionRequest_Load) Reset()

func (*TransactionRequest_Load) String

func (m *TransactionRequest_Load) String() string

func (*TransactionRequest_Load) Unmarshal

func (m *TransactionRequest_Load) Unmarshal(dAtA []byte) error

func (*TransactionRequest_Load) Validate

func (m *TransactionRequest_Load) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionRequest_Load) XXX_DiscardUnknown

func (m *TransactionRequest_Load) XXX_DiscardUnknown()

func (*TransactionRequest_Load) XXX_Marshal

func (m *TransactionRequest_Load) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionRequest_Load) XXX_Merge

func (m *TransactionRequest_Load) XXX_Merge(src proto.Message)

func (*TransactionRequest_Load) XXX_Size

func (m *TransactionRequest_Load) XXX_Size() int

func (*TransactionRequest_Load) XXX_Unmarshal

func (m *TransactionRequest_Load) XXX_Unmarshal(b []byte) error

type TransactionRequest_Open

type TransactionRequest_Open struct {
	// Materialization to be transacted.
	Materialization *flow.MaterializationSpec `protobuf:"bytes,1,opt,name=materialization,proto3" json:"materialization,omitempty"`
	// Version of the opened MaterializationSpec.
	// The driver may want to require that this match the version last
	// provided to a successful Apply RPC. It's possible that it won't,
	// due to expected propagation races in Flow's distributed runtime.
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// [begin, end] inclusive range of keys processed by this transaction
	// stream. Ranges are with respect to a 32-bit hash of a packed document
	// key.
	KeyBegin uint32 `protobuf:"fixed32,3,opt,name=key_begin,json=keyBegin,proto3" json:"key_begin,omitempty"`
	KeyEnd   uint32 `protobuf:"fixed32,4,opt,name=key_end,json=keyEnd,proto3" json:"key_end,omitempty"`
	// Last-persisted driver checkpoint committed in the Flow runtime recovery
	// log. Or empty, if the driver has cleared or never set its checkpoint.
	DriverCheckpointJson encoding_json.RawMessage `` /* 153-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                 `json:"-"`
	XXX_unrecognized     []byte                   `json:"-"`
	XXX_sizecache        int32                    `json:"-"`
}

Open a transaction stream.

If the Flow recovery log is authoritative: The driver is given its last committed driver checkpoint in this request. It MAY return a Flow checkpoint in its opened response -- perhaps an older Flow checkpoint which was previously embedded within its driver checkpoint.

If the remote store is authoritative: The driver MUST fence off other streams of this materialization that overlap the provided [key_begin, key_end) range, such that those streams cannot issue further commits. The driver MUST return its stored checkpoint for this materialization and range [key_begin, key_end] in its Opened response.

func (*TransactionRequest_Open) Descriptor

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

func (*TransactionRequest_Open) Marshal

func (m *TransactionRequest_Open) Marshal() (dAtA []byte, err error)

func (*TransactionRequest_Open) MarshalJSON

func (m *TransactionRequest_Open) MarshalJSON() ([]byte, error)

func (*TransactionRequest_Open) MarshalTo

func (m *TransactionRequest_Open) MarshalTo(dAtA []byte) (int, error)

func (*TransactionRequest_Open) MarshalToSizedBuffer

func (m *TransactionRequest_Open) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionRequest_Open) ProtoMessage

func (*TransactionRequest_Open) ProtoMessage()

func (*TransactionRequest_Open) ProtoSize

func (m *TransactionRequest_Open) ProtoSize() (n int)

func (*TransactionRequest_Open) Reset

func (m *TransactionRequest_Open) Reset()

func (*TransactionRequest_Open) String

func (m *TransactionRequest_Open) String() string

func (*TransactionRequest_Open) Unmarshal

func (m *TransactionRequest_Open) Unmarshal(dAtA []byte) error

func (*TransactionRequest_Open) UnmarshalJSON

func (m *TransactionRequest_Open) UnmarshalJSON(b []byte) error

func (*TransactionRequest_Open) Validate

func (m *TransactionRequest_Open) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionRequest_Open) XXX_DiscardUnknown

func (m *TransactionRequest_Open) XXX_DiscardUnknown()

func (*TransactionRequest_Open) XXX_Marshal

func (m *TransactionRequest_Open) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionRequest_Open) XXX_Merge

func (m *TransactionRequest_Open) XXX_Merge(src proto.Message)

func (*TransactionRequest_Open) XXX_Size

func (m *TransactionRequest_Open) XXX_Size() int

func (*TransactionRequest_Open) XXX_Unmarshal

func (m *TransactionRequest_Open) XXX_Unmarshal(b []byte) error

type TransactionRequest_Prepare

type TransactionRequest_Prepare struct {
	// Flow checkpoint to commit with this transaction.
	FlowCheckpoint       []byte   `protobuf:"bytes,1,opt,name=flow_checkpoint,json=flowCheckpoint,proto3" json:"flow_checkpoint,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Prepare to commit. No further Loads will be sent in this transaction.

func (*TransactionRequest_Prepare) Descriptor

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

func (*TransactionRequest_Prepare) Marshal

func (m *TransactionRequest_Prepare) Marshal() (dAtA []byte, err error)

func (*TransactionRequest_Prepare) MarshalTo

func (m *TransactionRequest_Prepare) MarshalTo(dAtA []byte) (int, error)

func (*TransactionRequest_Prepare) MarshalToSizedBuffer

func (m *TransactionRequest_Prepare) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionRequest_Prepare) ProtoMessage

func (*TransactionRequest_Prepare) ProtoMessage()

func (*TransactionRequest_Prepare) ProtoSize

func (m *TransactionRequest_Prepare) ProtoSize() (n int)

func (*TransactionRequest_Prepare) Reset

func (m *TransactionRequest_Prepare) Reset()

func (*TransactionRequest_Prepare) String

func (m *TransactionRequest_Prepare) String() string

func (*TransactionRequest_Prepare) Unmarshal

func (m *TransactionRequest_Prepare) Unmarshal(dAtA []byte) error

func (*TransactionRequest_Prepare) Validate

func (m *TransactionRequest_Prepare) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionRequest_Prepare) XXX_DiscardUnknown

func (m *TransactionRequest_Prepare) XXX_DiscardUnknown()

func (*TransactionRequest_Prepare) XXX_Marshal

func (m *TransactionRequest_Prepare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionRequest_Prepare) XXX_Merge

func (m *TransactionRequest_Prepare) XXX_Merge(src proto.Message)

func (*TransactionRequest_Prepare) XXX_Size

func (m *TransactionRequest_Prepare) XXX_Size() int

func (*TransactionRequest_Prepare) XXX_Unmarshal

func (m *TransactionRequest_Prepare) XXX_Unmarshal(b []byte) error

type TransactionRequest_Store

type TransactionRequest_Store struct {
	// The materialization binding for documents of this Store request.
	Binding uint32 `protobuf:"varint,1,opt,name=binding,proto3" json:"binding,omitempty"`
	// Byte arena of the request.
	Arena github_com_estuary_protocols_flow.Arena `protobuf:"bytes,2,opt,name=arena,proto3,casttype=github.com/estuary/protocols/flow.Arena" json:"arena,omitempty"`
	// Packed tuples holding keys of each document.
	PackedKeys []flow.Slice `protobuf:"bytes,3,rep,name=packed_keys,json=packedKeys,proto3" json:"packed_keys"`
	// Packed tuples holding values for each document.
	PackedValues []flow.Slice `protobuf:"bytes,4,rep,name=packed_values,json=packedValues,proto3" json:"packed_values"`
	// JSON documents.
	DocsJson []flow.Slice `protobuf:"bytes,5,rep,name=docs_json,json=docsJson,proto3" json:"docs_json"`
	// Exists is true if this document as previously been loaded or stored.
	Exists               []bool   `protobuf:"varint,6,rep,packed,name=exists,proto3" json:"exists,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Store documents of this transaction commit.

func (*TransactionRequest_Store) Descriptor

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

func (*TransactionRequest_Store) Marshal

func (m *TransactionRequest_Store) Marshal() (dAtA []byte, err error)

func (*TransactionRequest_Store) MarshalTo

func (m *TransactionRequest_Store) MarshalTo(dAtA []byte) (int, error)

func (*TransactionRequest_Store) MarshalToSizedBuffer

func (m *TransactionRequest_Store) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionRequest_Store) ProtoMessage

func (*TransactionRequest_Store) ProtoMessage()

func (*TransactionRequest_Store) ProtoSize

func (m *TransactionRequest_Store) ProtoSize() (n int)

func (*TransactionRequest_Store) Reset

func (m *TransactionRequest_Store) Reset()

func (*TransactionRequest_Store) String

func (m *TransactionRequest_Store) String() string

func (*TransactionRequest_Store) Unmarshal

func (m *TransactionRequest_Store) Unmarshal(dAtA []byte) error

func (*TransactionRequest_Store) Validate

func (m *TransactionRequest_Store) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionRequest_Store) XXX_DiscardUnknown

func (m *TransactionRequest_Store) XXX_DiscardUnknown()

func (*TransactionRequest_Store) XXX_Marshal

func (m *TransactionRequest_Store) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionRequest_Store) XXX_Merge

func (m *TransactionRequest_Store) XXX_Merge(src proto.Message)

func (*TransactionRequest_Store) XXX_Size

func (m *TransactionRequest_Store) XXX_Size() int

func (*TransactionRequest_Store) XXX_Unmarshal

func (m *TransactionRequest_Store) XXX_Unmarshal(b []byte) error

type TransactionResponse

type TransactionResponse struct {
	Opened *TransactionResponse_Opened `protobuf:"bytes,1,opt,name=opened,proto3" json:"opened,omitempty"`
	Loaded *TransactionResponse_Loaded `protobuf:"bytes,2,opt,name=loaded,proto3" json:"loaded,omitempty"`
	// Prepared responds to a TransactionRequest.Prepare of the client.
	// No further Loaded responses will be sent.
	Prepared             *flow.DriverCheckpoint               `protobuf:"bytes,3,opt,name=prepared,proto3" json:"prepared,omitempty"`
	DriverCommitted      *TransactionResponse_DriverCommitted `protobuf:"bytes,4,opt,name=driver_committed,json=driverCommitted,proto3" json:"driver_committed,omitempty"`
	Acknowledged         *TransactionResponse_Acknowledged    `protobuf:"bytes,5,opt,name=acknowledged,proto3" json:"acknowledged,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                             `json:"-"`
	XXX_unrecognized     []byte                               `json:"-"`
	XXX_sizecache        int32                                `json:"-"`
}

TransactionResponse is the response type of a Transaction RPC. It will have exactly one top-level field set, which represents its message type.

func Rx

func Rx(ch <-chan TransactionResponseError, block bool) (*TransactionResponse, error)

Rx receives from a TransactionResponse channel. It de-structures TransactionResponse into its parts, and also returns an explicit io.EOF for channel closures.

func (*TransactionResponse) Descriptor

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

func (*TransactionResponse) Marshal

func (m *TransactionResponse) Marshal() (dAtA []byte, err error)

func (*TransactionResponse) MarshalTo

func (m *TransactionResponse) MarshalTo(dAtA []byte) (int, error)

func (*TransactionResponse) MarshalToSizedBuffer

func (m *TransactionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionResponse) ProtoMessage

func (*TransactionResponse) ProtoMessage()

func (*TransactionResponse) ProtoSize

func (m *TransactionResponse) ProtoSize() (n int)

func (*TransactionResponse) Reset

func (m *TransactionResponse) Reset()

func (*TransactionResponse) String

func (m *TransactionResponse) String() string

func (*TransactionResponse) Unmarshal

func (m *TransactionResponse) Unmarshal(dAtA []byte) error

func (*TransactionResponse) Validate

func (m *TransactionResponse) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionResponse) XXX_DiscardUnknown

func (m *TransactionResponse) XXX_DiscardUnknown()

func (*TransactionResponse) XXX_Marshal

func (m *TransactionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionResponse) XXX_Merge

func (m *TransactionResponse) XXX_Merge(src proto.Message)

func (*TransactionResponse) XXX_Size

func (m *TransactionResponse) XXX_Size() int

func (*TransactionResponse) XXX_Unmarshal

func (m *TransactionResponse) XXX_Unmarshal(b []byte) error

type TransactionResponseError

type TransactionResponseError struct {
	*TransactionResponse
	Error error
}

TransactionResponseError is a channel-oriented wrapper of TransactionResponse.

type TransactionResponse_Acknowledged

type TransactionResponse_Acknowledged struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Notify the Flow runtime of receipt of it's confirmation that the Flow recovery log has committed.

If the driver utilizes staged data which is idempotently applied, it must apply staged data of the commit at this time, and respond with Acknowledged only once that's completed.

func (*TransactionResponse_Acknowledged) Descriptor

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

func (*TransactionResponse_Acknowledged) Marshal

func (m *TransactionResponse_Acknowledged) Marshal() (dAtA []byte, err error)

func (*TransactionResponse_Acknowledged) MarshalTo

func (m *TransactionResponse_Acknowledged) MarshalTo(dAtA []byte) (int, error)

func (*TransactionResponse_Acknowledged) MarshalToSizedBuffer

func (m *TransactionResponse_Acknowledged) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionResponse_Acknowledged) ProtoMessage

func (*TransactionResponse_Acknowledged) ProtoMessage()

func (*TransactionResponse_Acknowledged) ProtoSize

func (m *TransactionResponse_Acknowledged) ProtoSize() (n int)

func (*TransactionResponse_Acknowledged) Reset

func (*TransactionResponse_Acknowledged) String

func (*TransactionResponse_Acknowledged) Unmarshal

func (m *TransactionResponse_Acknowledged) Unmarshal(dAtA []byte) error

func (*TransactionResponse_Acknowledged) Validate

Validate returns an error if the message is not well-formed.

func (*TransactionResponse_Acknowledged) XXX_DiscardUnknown

func (m *TransactionResponse_Acknowledged) XXX_DiscardUnknown()

func (*TransactionResponse_Acknowledged) XXX_Marshal

func (m *TransactionResponse_Acknowledged) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionResponse_Acknowledged) XXX_Merge

func (*TransactionResponse_Acknowledged) XXX_Size

func (m *TransactionResponse_Acknowledged) XXX_Size() int

func (*TransactionResponse_Acknowledged) XXX_Unmarshal

func (m *TransactionResponse_Acknowledged) XXX_Unmarshal(b []byte) error

type TransactionResponse_DriverCommitted

type TransactionResponse_DriverCommitted struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Mark the end of the Store phase, indicating that all documents have been fully stored.

If the remote store is authoritative, tell the Flow runtime that it has committed.

If the recovery log is authoritative, DriverCommitted is sent but no actual transactional driver commit is performed.

func (*TransactionResponse_DriverCommitted) Descriptor

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

func (*TransactionResponse_DriverCommitted) Marshal

func (m *TransactionResponse_DriverCommitted) Marshal() (dAtA []byte, err error)

func (*TransactionResponse_DriverCommitted) MarshalTo

func (m *TransactionResponse_DriverCommitted) MarshalTo(dAtA []byte) (int, error)

func (*TransactionResponse_DriverCommitted) MarshalToSizedBuffer

func (m *TransactionResponse_DriverCommitted) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionResponse_DriverCommitted) ProtoMessage

func (*TransactionResponse_DriverCommitted) ProtoMessage()

func (*TransactionResponse_DriverCommitted) ProtoSize

func (m *TransactionResponse_DriverCommitted) ProtoSize() (n int)

func (*TransactionResponse_DriverCommitted) Reset

func (*TransactionResponse_DriverCommitted) String

func (*TransactionResponse_DriverCommitted) Unmarshal

func (m *TransactionResponse_DriverCommitted) Unmarshal(dAtA []byte) error

func (*TransactionResponse_DriverCommitted) Validate

Validate returns an error if the message is not well-formed.

func (*TransactionResponse_DriverCommitted) XXX_DiscardUnknown

func (m *TransactionResponse_DriverCommitted) XXX_DiscardUnknown()

func (*TransactionResponse_DriverCommitted) XXX_Marshal

func (m *TransactionResponse_DriverCommitted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionResponse_DriverCommitted) XXX_Merge

func (*TransactionResponse_DriverCommitted) XXX_Size

func (*TransactionResponse_DriverCommitted) XXX_Unmarshal

func (m *TransactionResponse_DriverCommitted) XXX_Unmarshal(b []byte) error

type TransactionResponse_Loaded

type TransactionResponse_Loaded struct {
	// The materialization binding for documents of this Loaded response.
	Binding uint32 `protobuf:"varint,1,opt,name=binding,proto3" json:"binding,omitempty"`
	// Byte arena of the request.
	Arena github_com_estuary_protocols_flow.Arena `protobuf:"bytes,2,opt,name=arena,proto3,casttype=github.com/estuary/protocols/flow.Arena" json:"arena,omitempty"`
	// Loaded JSON documents.
	DocsJson             []flow.Slice `protobuf:"bytes,3,rep,name=docs_json,json=docsJson,proto3" json:"docs_json"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

Loaded responds to TransactionRequest.Loads of the client. It returns documents of requested keys which have previously been stored. Keys not found in the store MUST be omitted. Documents may be in any order, both within and across Loaded response messages, but a document of a given key MUST be sent at most one time in a Transaction.

func (*TransactionResponse_Loaded) Descriptor

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

func (*TransactionResponse_Loaded) Marshal

func (m *TransactionResponse_Loaded) Marshal() (dAtA []byte, err error)

func (*TransactionResponse_Loaded) MarshalTo

func (m *TransactionResponse_Loaded) MarshalTo(dAtA []byte) (int, error)

func (*TransactionResponse_Loaded) MarshalToSizedBuffer

func (m *TransactionResponse_Loaded) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionResponse_Loaded) ProtoMessage

func (*TransactionResponse_Loaded) ProtoMessage()

func (*TransactionResponse_Loaded) ProtoSize

func (m *TransactionResponse_Loaded) ProtoSize() (n int)

func (*TransactionResponse_Loaded) Reset

func (m *TransactionResponse_Loaded) Reset()

func (*TransactionResponse_Loaded) String

func (m *TransactionResponse_Loaded) String() string

func (*TransactionResponse_Loaded) Unmarshal

func (m *TransactionResponse_Loaded) Unmarshal(dAtA []byte) error

func (*TransactionResponse_Loaded) Validate

func (m *TransactionResponse_Loaded) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionResponse_Loaded) XXX_DiscardUnknown

func (m *TransactionResponse_Loaded) XXX_DiscardUnknown()

func (*TransactionResponse_Loaded) XXX_Marshal

func (m *TransactionResponse_Loaded) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionResponse_Loaded) XXX_Merge

func (m *TransactionResponse_Loaded) XXX_Merge(src proto.Message)

func (*TransactionResponse_Loaded) XXX_Size

func (m *TransactionResponse_Loaded) XXX_Size() int

func (*TransactionResponse_Loaded) XXX_Unmarshal

func (m *TransactionResponse_Loaded) XXX_Unmarshal(b []byte) error

type TransactionResponse_Opened

type TransactionResponse_Opened struct {
	// Flow checkpoint to begin processing from.
	// If empty, the most recent checkpoint of the Flow recovery log is used.
	//
	// Or, a driver may send the value []byte{0xf8, 0xff, 0xff, 0xff, 0xf, 0x1}
	// to explicitly begin processing from a zero-valued checkpoint, effectively
	// rebuilding the materialization from scratch. This sentinel is a trivial
	// encoding of the max-value 2^29-1 protobuf tag with boolean true.
	FlowCheckpoint       []byte   `protobuf:"bytes,1,opt,name=flow_checkpoint,json=flowCheckpoint,proto3" json:"flow_checkpoint,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Opened responds to TransactionRequest.Open of the client.

func (*TransactionResponse_Opened) Descriptor

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

func (*TransactionResponse_Opened) Marshal

func (m *TransactionResponse_Opened) Marshal() (dAtA []byte, err error)

func (*TransactionResponse_Opened) MarshalJSON

func (m *TransactionResponse_Opened) MarshalJSON() ([]byte, error)

func (*TransactionResponse_Opened) MarshalTo

func (m *TransactionResponse_Opened) MarshalTo(dAtA []byte) (int, error)

func (*TransactionResponse_Opened) MarshalToSizedBuffer

func (m *TransactionResponse_Opened) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransactionResponse_Opened) ProtoMessage

func (*TransactionResponse_Opened) ProtoMessage()

func (*TransactionResponse_Opened) ProtoSize

func (m *TransactionResponse_Opened) ProtoSize() (n int)

func (*TransactionResponse_Opened) Reset

func (m *TransactionResponse_Opened) Reset()

func (*TransactionResponse_Opened) String

func (m *TransactionResponse_Opened) String() string

func (*TransactionResponse_Opened) Unmarshal

func (m *TransactionResponse_Opened) Unmarshal(dAtA []byte) error

func (*TransactionResponse_Opened) UnmarshalJSON

func (m *TransactionResponse_Opened) UnmarshalJSON(b []byte) error

func (*TransactionResponse_Opened) Validate

func (m *TransactionResponse_Opened) Validate() error

Validate returns an error if the message is not well-formed.

func (*TransactionResponse_Opened) XXX_DiscardUnknown

func (m *TransactionResponse_Opened) XXX_DiscardUnknown()

func (*TransactionResponse_Opened) XXX_Marshal

func (m *TransactionResponse_Opened) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionResponse_Opened) XXX_Merge

func (m *TransactionResponse_Opened) XXX_Merge(src proto.Message)

func (*TransactionResponse_Opened) XXX_Size

func (m *TransactionResponse_Opened) XXX_Size() int

func (*TransactionResponse_Opened) XXX_Unmarshal

func (m *TransactionResponse_Opened) XXX_Unmarshal(b []byte) error

type Transactor

type Transactor interface {
	// Load implements the transaction load phase by consuming Load requests
	// from the LoadIterator until a Prepare request is read. Requested keys
	// are not known to exist in the store, and very often they won't.
	// Load can ignore keys which are not found in the store. Before Load returns,
	// though, it must ensure loaded() is called for all found documents.
	//
	// Loads of transaction T+1 will be invoked after Store of T+0, but
	// concurrently with the commit and acknowledgement of T+0. This is an
	// important optimization that allows the driver to immediately begin the work
	// of T+1, for instance by staging Load keys into a temporary table which will
	// be joined and queried once the LoadIterator is drained.
	//
	// But, the driver contract is that documents loaded in T+1 must reflect
	// stores of T+0 (a.k.a. "read committed"). The driver must ensure that the
	// prior transaction is fully reflected in the store before attempting to
	// load any keys.
	//
	// Load is given two channels, priorCommittedCh and priorAcknowledgedCh,
	// to help it understand where the prior transaction is in its lifecycle.
	//  - priorCommittedCh selects (is closed) upon the completion of Transactor.Commit.
	//  - priorAcknowledgedCh selects (is closed) upon completion of Transactor.Acknowledge.
	//
	// * In the simple case where the driver uses implementation pattern
	//   "Recovery Log with Non-Transactional Store", the driver is free
	//   to simply ignore these signals. It may issue lookups to the store and call
	//   back to loaded() when those lookups succeed.
	//
	// * If the driver uses implementation pattern "Remote Store is Authoritative",
	//   it MUST await priorCommittedCh before loading from the store to ensure
	//   read-committed behavior (priorAcknowledgedCh is ignored).
	//   For ease of implementation, it MAY delay reading from the LoadIterator
	//   until priorCommittedCh is signaled to ensure this behavior.
	//
	//   After priorCommittedCh it MAY immediately evaluate loads against the store,
	//   calling back to loaded().
	//
	//   For simplicity it may wish to stage all loads, draining the LoadIterator,
	//   and only then evaluate staged keys against the store. In this case it
	//   can ignore priorCommittedCh, as the LoadIterator will drain only after
	//   it has been signaled.
	//
	// * If the driver uses pattern "Recovery Log with Idempotent Apply",
	//   it MUST await priorAcknowledgedCh before loading from the store,
	//   which indicates that Acknowledge has completed and applied the prior
	//   commit to the store.
	//
	//   The LoadIterator needs to make progress in order for acknowledgement
	//   to occur, and the driver MUST read from LoadIterator and stage those
	//   loads for future evaluation once priorAcknowledgedCh is signaled.
	//   Otherwise the transaction will deadlock.
	//
	//   After priorAcknowledgedCh it MAY immediately evaluate loads against the
	//   store, calling back to loaded().
	//
	//   For simplicity it may wish to stage all loads, draining the LoadIterator,
	//   and only then evaluate staged keys against the store. In this case it
	//   can ignore priorAcknowledgedCh, as the LoadIterator will drain only after
	//   it has been signaled.
	//
	Load(
		it *LoadIterator,
		priorCommittedCh <-chan struct{},
		priorAcknowledgedCh <-chan struct{},
		loaded func(binding int, doc json.RawMessage) error,
	) error
	// Prepare begins the transaction store phase.
	//
	// If the remote store is authoritative, the driver must stage the
	// request's Flow checkpoint for its future driver commit.
	//
	// If the recovery log is authoritative, the driver may wish to provide a
	// driver update which will be included in the log's commit. At this stage
	// the transaction hasn't stored any documents yet, so the driver checkpoint
	// may want to include what the driver _plans_ to do.
	Prepare(context.Context, TransactionRequest_Prepare) (pf.DriverCheckpoint, error)
	// Store consumes Store requests from the StoreIterator.
	Store(*StoreIterator) error
	// Commit is called upon the Flow runtime's request that the driver commit
	// its transaction. Commit does so, and returns a final error status.
	// If the driver doesn't use store transactions, Commit may be a no-op.
	//
	// Note that Commit runs concurrently with Transactor.Load().
	Commit(context.Context) error
	// Acknowledge is called upon the Flow runtime's acknowledgement of its
	// recovery log commit. If the driver stages data for application after
	// commit, it must perform that apply now and return a final error status.
	//
	// Note that Acknowledge may be called multiple times in acknowledgement
	// of a single actual commit. The driver must account for this. If it applies
	// staged data as part of acknowledgement, it must ensure that apply is
	// idempotent.
	//
	// Note that Acknowledge runs concurrently with Transactor.Load().
	Acknowledge(context.Context) error
	// Destroy the Transactor, releasing any held resources.
	Destroy()
}

Transactor is a store-agnostic interface for a materialization driver that implements Flow materialization protocol transactions.

type TxnClient

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

TxnClient is a client of a driver's Transactions RPC.

func OpenTransactions

func OpenTransactions(
	ctx context.Context,
	driver DriverClient,
	driverCheckpoint json.RawMessage,
	newCombinerFn func(*pf.MaterializationSpec_Binding) (pf.Combiner, error),
	range_ pf.RangeSpec,
	spec *pf.MaterializationSpec,
	version string,
) (*TxnClient, error)

OpenTransactions opens a Transactions RPC. It returns a *TxnClient which provides a high-level API for executing the materialization transaction workflow.

func (*TxnClient) AddDocument

func (f *TxnClient) AddDocument(binding int, packedKey []byte, doc json.RawMessage) error

AddDocument to the current transaction under the given binding and tuple-encoded key.

func (*TxnClient) Close

func (f *TxnClient) Close() error

Close the TxnClient. Close returns an error if the RPC is not in an Acknowledged and idle state, or on any other error.

func (*TxnClient) Opened

Opened returns the driver's prior Opened response.

func (*TxnClient) Prepare

func (f *TxnClient) Prepare(flowCheckpoint pf.Checkpoint) (pf.DriverCheckpoint, error)

Prepare to commit with the given Checkpoint. Block until the driver's Prepared response is read, with an optional driver checkpoint to commit in the Flow recovery log.

func (*TxnClient) StartCommit

func (f *TxnClient) StartCommit(ops CommitOps) ([]*pf.CombineAPI_Stats, error)

StartCommit of the prepared transaction. The CommitOps must be initialized by the caller. The caller must arrange for LogCommitted to be resolved appropriately, after DriverCommitted. The *TxnClient will resolve DriverCommitted & Acknowledged.

type UnimplementedDriverServer

type UnimplementedDriverServer struct {
}

UnimplementedDriverServer can be embedded to have forward compatible implementations.

func (*UnimplementedDriverServer) ApplyDelete

func (*UnimplementedDriverServer) ApplyUpsert

func (*UnimplementedDriverServer) Spec

func (*UnimplementedDriverServer) Transactions

func (*UnimplementedDriverServer) Validate

type ValidateRequest

type ValidateRequest struct {
	// Name of the materialization being validated.
	Materialization github_com_estuary_protocols_flow.Materialization `` /* 142-byte string literal not displayed */
	// Endpoint type addressed by this request.
	EndpointType flow.EndpointType `protobuf:"varint,2,opt,name=endpoint_type,json=endpointType,proto3,enum=flow.EndpointType" json:"endpoint_type,omitempty"`
	// Driver specification, as an encoded JSON object.
	EndpointSpecJson     encoding_json.RawMessage   `` /* 141-byte string literal not displayed */
	Bindings             []*ValidateRequest_Binding `protobuf:"bytes,4,rep,name=bindings,proto3" json:"bindings,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
	XXX_unrecognized     []byte                     `json:"-"`
	XXX_sizecache        int32                      `json:"-"`
}

ValidateRequest is the request type of the Validate RPC.

func (*ValidateRequest) Descriptor

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

func (*ValidateRequest) Marshal

func (m *ValidateRequest) Marshal() (dAtA []byte, err error)

func (*ValidateRequest) MarshalJSON

func (m *ValidateRequest) MarshalJSON() ([]byte, error)

func (*ValidateRequest) MarshalTo

func (m *ValidateRequest) MarshalTo(dAtA []byte) (int, error)

func (*ValidateRequest) MarshalToSizedBuffer

func (m *ValidateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ValidateRequest) ProtoMessage

func (*ValidateRequest) ProtoMessage()

func (*ValidateRequest) ProtoSize

func (m *ValidateRequest) ProtoSize() (n int)

func (*ValidateRequest) Reset

func (m *ValidateRequest) Reset()

func (*ValidateRequest) String

func (m *ValidateRequest) String() string

func (*ValidateRequest) Unmarshal

func (m *ValidateRequest) Unmarshal(dAtA []byte) error

func (*ValidateRequest) UnmarshalJSON

func (m *ValidateRequest) UnmarshalJSON(b []byte) error

func (*ValidateRequest) Validate

func (m *ValidateRequest) Validate() error

Validate returns an error if the ValidateRequest isn't well-formed.

func (*ValidateRequest) XXX_DiscardUnknown

func (m *ValidateRequest) XXX_DiscardUnknown()

func (*ValidateRequest) XXX_Marshal

func (m *ValidateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ValidateRequest) XXX_Merge

func (m *ValidateRequest) XXX_Merge(src proto.Message)

func (*ValidateRequest) XXX_Size

func (m *ValidateRequest) XXX_Size() int

func (*ValidateRequest) XXX_Unmarshal

func (m *ValidateRequest) XXX_Unmarshal(b []byte) error

type ValidateRequest_Binding

type ValidateRequest_Binding struct {
	// JSON-encoded object which specifies the endpoint resource to be
	// materialized.
	ResourceSpecJson encoding_json.RawMessage `` /* 141-byte string literal not displayed */
	// Collection to be materialized.
	Collection flow.CollectionSpec `protobuf:"bytes,2,opt,name=collection,proto3" json:"collection"`
	// Projection configuration, keyed by the projection field name,
	// with JSON-encoded and driver-defined configuration objects.
	FieldConfigJson      map[string]encoding_json.RawMessage `` /* 227-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                            `json:"-"`
	XXX_unrecognized     []byte                              `json:"-"`
	XXX_sizecache        int32                               `json:"-"`
}

Bindings of endpoint resources and collections from which they would be materialized. Bindings are ordered and unique on the bound collection name.

func (*ValidateRequest_Binding) Descriptor

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

func (*ValidateRequest_Binding) Marshal

func (m *ValidateRequest_Binding) Marshal() (dAtA []byte, err error)

func (*ValidateRequest_Binding) MarshalTo

func (m *ValidateRequest_Binding) MarshalTo(dAtA []byte) (int, error)

func (*ValidateRequest_Binding) MarshalToSizedBuffer

func (m *ValidateRequest_Binding) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ValidateRequest_Binding) ProtoMessage

func (*ValidateRequest_Binding) ProtoMessage()

func (*ValidateRequest_Binding) ProtoSize

func (m *ValidateRequest_Binding) ProtoSize() (n int)

func (*ValidateRequest_Binding) Reset

func (m *ValidateRequest_Binding) Reset()

func (*ValidateRequest_Binding) String

func (m *ValidateRequest_Binding) String() string

func (*ValidateRequest_Binding) Unmarshal

func (m *ValidateRequest_Binding) Unmarshal(dAtA []byte) error

func (*ValidateRequest_Binding) Validate

func (m *ValidateRequest_Binding) Validate() error

Validate returns an error if the ValidateRequest_Binding isn't well-formed.

func (*ValidateRequest_Binding) XXX_DiscardUnknown

func (m *ValidateRequest_Binding) XXX_DiscardUnknown()

func (*ValidateRequest_Binding) XXX_Marshal

func (m *ValidateRequest_Binding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ValidateRequest_Binding) XXX_Merge

func (m *ValidateRequest_Binding) XXX_Merge(src proto.Message)

func (*ValidateRequest_Binding) XXX_Size

func (m *ValidateRequest_Binding) XXX_Size() int

func (*ValidateRequest_Binding) XXX_Unmarshal

func (m *ValidateRequest_Binding) XXX_Unmarshal(b []byte) error

type ValidateResponse

type ValidateResponse struct {
	Bindings             []*ValidateResponse_Binding `protobuf:"bytes,1,rep,name=bindings,proto3" json:"bindings,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                    `json:"-"`
	XXX_unrecognized     []byte                      `json:"-"`
	XXX_sizecache        int32                       `json:"-"`
}

ValidateResponse is the response type of the Validate RPC.

func (*ValidateResponse) Descriptor

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

func (*ValidateResponse) Marshal

func (m *ValidateResponse) Marshal() (dAtA []byte, err error)

func (*ValidateResponse) MarshalJSON

func (m *ValidateResponse) MarshalJSON() ([]byte, error)

func (*ValidateResponse) MarshalTo

func (m *ValidateResponse) MarshalTo(dAtA []byte) (int, error)

func (*ValidateResponse) MarshalToSizedBuffer

func (m *ValidateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ValidateResponse) ProtoMessage

func (*ValidateResponse) ProtoMessage()

func (*ValidateResponse) ProtoSize

func (m *ValidateResponse) ProtoSize() (n int)

func (*ValidateResponse) Reset

func (m *ValidateResponse) Reset()

func (*ValidateResponse) String

func (m *ValidateResponse) String() string

func (*ValidateResponse) Unmarshal

func (m *ValidateResponse) Unmarshal(dAtA []byte) error

func (*ValidateResponse) UnmarshalJSON

func (m *ValidateResponse) UnmarshalJSON(b []byte) error

func (*ValidateResponse) Validate

func (m *ValidateResponse) Validate() error

Validate returns an error if the ValidateResponse isn't well-formed.

func (*ValidateResponse) XXX_DiscardUnknown

func (m *ValidateResponse) XXX_DiscardUnknown()

func (*ValidateResponse) XXX_Marshal

func (m *ValidateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ValidateResponse) XXX_Merge

func (m *ValidateResponse) XXX_Merge(src proto.Message)

func (*ValidateResponse) XXX_Size

func (m *ValidateResponse) XXX_Size() int

func (*ValidateResponse) XXX_Unmarshal

func (m *ValidateResponse) XXX_Unmarshal(b []byte) error

type ValidateResponse_Binding

type ValidateResponse_Binding struct {
	// Constraints over collection projections imposed by the Driver,
	// keyed by the projection field name. Projections of the CollectionSpec
	// which are missing from constraints are implicitly forbidden.
	Constraints map[string]*Constraint `` /* 163-byte string literal not displayed */
	// Components of the resource path which fully qualify the resource
	// identified by this binding.
	// - For an RDBMS, this might be []{dbname, schema, table}.
	// - For Kafka, this might be []{topic}.
	// - For Redis, this might be []{key_prefix}.
	ResourcePath []string `protobuf:"bytes,2,rep,name=resource_path,json=resourcePath,proto3" json:"resource_path,omitempty"`
	// Materialize combined delta updates of documents rather than full
	// reductions.
	//
	// When set, the Flow runtime will not attempt to load documents via
	// TransactionRequest.Load, and also disables re-use of cached documents
	// stored in prior transactions. Each stored document is exclusively
	// combined from updates processed by the runtime within the current
	// transaction only.
	//
	// This is appropriate for drivers over streams, WebHooks, and append-only
	// files.
	//
	// For example, given a collection which reduces a sum count for each key,
	// its materialization will produce a stream of delta updates to the count,
	// such that a reader of the stream will arrive at the correct total count.
	DeltaUpdates         bool     `protobuf:"varint,3,opt,name=delta_updates,json=deltaUpdates,proto3" json:"delta_updates,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Validation responses for each binding of the request, and matching the request ordering. Each Binding must have a unique resource_path.

func (*ValidateResponse_Binding) Descriptor

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

func (*ValidateResponse_Binding) Marshal

func (m *ValidateResponse_Binding) Marshal() (dAtA []byte, err error)

func (*ValidateResponse_Binding) MarshalTo

func (m *ValidateResponse_Binding) MarshalTo(dAtA []byte) (int, error)

func (*ValidateResponse_Binding) MarshalToSizedBuffer

func (m *ValidateResponse_Binding) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ValidateResponse_Binding) ProtoMessage

func (*ValidateResponse_Binding) ProtoMessage()

func (*ValidateResponse_Binding) ProtoSize

func (m *ValidateResponse_Binding) ProtoSize() (n int)

func (*ValidateResponse_Binding) Reset

func (m *ValidateResponse_Binding) Reset()

func (*ValidateResponse_Binding) String

func (m *ValidateResponse_Binding) String() string

func (*ValidateResponse_Binding) Unmarshal

func (m *ValidateResponse_Binding) Unmarshal(dAtA []byte) error

func (*ValidateResponse_Binding) Validate

func (m *ValidateResponse_Binding) Validate() error

Validate returns an error if the ValidateResponse_Binding isn't well-formed.

func (*ValidateResponse_Binding) XXX_DiscardUnknown

func (m *ValidateResponse_Binding) XXX_DiscardUnknown()

func (*ValidateResponse_Binding) XXX_Marshal

func (m *ValidateResponse_Binding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ValidateResponse_Binding) XXX_Merge

func (m *ValidateResponse_Binding) XXX_Merge(src proto.Message)

func (*ValidateResponse_Binding) XXX_Size

func (m *ValidateResponse_Binding) XXX_Size() int

func (*ValidateResponse_Binding) XXX_Unmarshal

func (m *ValidateResponse_Binding) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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