Documentation ¶
Index ¶
- type AuthTransactionServer
- type AuthWrites
- type MockAuthTransactionServer
- func (mats *MockAuthTransactionServer) AuthorizeInTransaction(*TransactionContext, *auth.AuthorizeRequest) (*auth.AuthorizeResponse, error)
- func (mats *MockAuthTransactionServer) GetACLInTransaction(*TransactionContext, *auth.GetACLRequest) (*auth.GetACLResponse, error)
- func (mats *MockAuthTransactionServer) GetScopeInTransaction(*TransactionContext, *auth.GetScopeRequest) (*auth.GetScopeResponse, error)
- func (mats *MockAuthTransactionServer) SetACLInTransaction(*TransactionContext, *auth.SetACLRequest) (*auth.SetACLResponse, error)
- func (mats *MockAuthTransactionServer) SetScopeInTransaction(*TransactionContext, *auth.SetScopeRequest) (*auth.SetScopeResponse, error)
- type MockPfsPropagater
- type MockPfsTransactionServer
- func (mpts *MockPfsTransactionServer) CreateBranchInTransaction(*TransactionContext, *pfs.CreateBranchRequest) error
- func (mpts *MockPfsTransactionServer) CreateRepoInTransaction(*TransactionContext, *pfs.CreateRepoRequest) error
- func (mpts *MockPfsTransactionServer) DeleteBranchInTransaction(*TransactionContext, *pfs.DeleteBranchRequest) error
- func (mpts *MockPfsTransactionServer) DeleteCommitInTransaction(*TransactionContext, *pfs.DeleteCommitRequest) error
- func (mpts *MockPfsTransactionServer) DeleteRepoInTransaction(*TransactionContext, *pfs.DeleteRepoRequest) error
- func (mpts *MockPfsTransactionServer) FinishCommitInTransaction(*TransactionContext, *pfs.FinishCommitRequest) error
- func (mpts *MockPfsTransactionServer) InspectRepoInTransaction(*TransactionContext, *pfs.InspectRepoRequest) (*pfs.RepoInfo, error)
- func (mpts *MockPfsTransactionServer) NewPropagater(col.STM) PfsPropagater
- func (mpts *MockPfsTransactionServer) StartCommitInTransaction(*TransactionContext, *pfs.StartCommitRequest, *pfs.Commit) (*pfs.Commit, error)
- type MockPpsTransactionServer
- type PfsPropagater
- type PfsTransactionServer
- type PfsWrites
- type PpsTransactionServer
- type PpsWrites
- type Transaction
- type TransactionContext
- type TransactionEnv
- func (env *TransactionEnv) Initialize(serviceEnv *serviceenv.ServiceEnv, txnServer TransactionServer, ...)
- func (env *TransactionEnv) WithReadContext(ctx context.Context, cb func(*TransactionContext) error) error
- func (env *TransactionEnv) WithTransaction(ctx context.Context, cb func(Transaction) error) error
- func (env *TransactionEnv) WithWriteContext(ctx context.Context, cb func(*TransactionContext) error) error
- type TransactionServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthTransactionServer ¶
type AuthTransactionServer interface { AuthorizeInTransaction(*TransactionContext, *auth.AuthorizeRequest) (*auth.AuthorizeResponse, error) GetScopeInTransaction(*TransactionContext, *auth.GetScopeRequest) (*auth.GetScopeResponse, error) SetScopeInTransaction(*TransactionContext, *auth.SetScopeRequest) (*auth.SetScopeResponse, error) GetACLInTransaction(*TransactionContext, *auth.GetACLRequest) (*auth.GetACLResponse, error) SetACLInTransaction(*TransactionContext, *auth.SetACLRequest) (*auth.SetACLResponse, error) }
AuthTransactionServer is an interface for the transactionally-supported methods that can be called through the auth server.
type AuthWrites ¶
type AuthWrites interface { SetScope(*auth.SetScopeRequest) (*auth.SetScopeResponse, error) SetACL(*auth.SetACLRequest) (*auth.SetACLResponse, error) }
AuthWrites is an interface providing a wrapper for each operation that may be appended to a transaction through the Auth server. Each call may either directly run the request through Auth or append it to the active transaction, depending on if there is an active transaction in the client context.
type MockAuthTransactionServer ¶ added in v1.9.10
type MockAuthTransactionServer struct{}
MockAuthTransactionServer is a simple mock that can be used to satisfy the AuthTransactionServer interface
func NewMockAuthTransactionServer ¶ added in v1.9.10
func NewMockAuthTransactionServer() *MockAuthTransactionServer
NewMockAuthTransactionServer instantiates a MockAuthTransactionServer
func (*MockAuthTransactionServer) AuthorizeInTransaction ¶ added in v1.9.10
func (mats *MockAuthTransactionServer) AuthorizeInTransaction(*TransactionContext, *auth.AuthorizeRequest) (*auth.AuthorizeResponse, error)
AuthorizeInTransaction always errors
func (*MockAuthTransactionServer) GetACLInTransaction ¶ added in v1.9.10
func (mats *MockAuthTransactionServer) GetACLInTransaction(*TransactionContext, *auth.GetACLRequest) (*auth.GetACLResponse, error)
GetACLInTransaction always errors
func (*MockAuthTransactionServer) GetScopeInTransaction ¶ added in v1.9.10
func (mats *MockAuthTransactionServer) GetScopeInTransaction(*TransactionContext, *auth.GetScopeRequest) (*auth.GetScopeResponse, error)
GetScopeInTransaction always errors
func (*MockAuthTransactionServer) SetACLInTransaction ¶ added in v1.9.10
func (mats *MockAuthTransactionServer) SetACLInTransaction(*TransactionContext, *auth.SetACLRequest) (*auth.SetACLResponse, error)
SetACLInTransaction always errors
func (*MockAuthTransactionServer) SetScopeInTransaction ¶ added in v1.9.10
func (mats *MockAuthTransactionServer) SetScopeInTransaction(*TransactionContext, *auth.SetScopeRequest) (*auth.SetScopeResponse, error)
SetScopeInTransaction always errors
type MockPfsPropagater ¶ added in v1.9.10
type MockPfsPropagater struct{}
MockPfsPropagater is a simple mock that can be used to satisfy the PfsPropagater interface
func NewMockPfsPropagater ¶ added in v1.9.10
func NewMockPfsPropagater() *MockPfsPropagater
NewMockPfsPropagater instantiates a MockPfsPropagater
func (*MockPfsPropagater) PropagateCommit ¶ added in v1.9.10
func (mpp *MockPfsPropagater) PropagateCommit(branch *pfs.Branch, isNewCommit bool) error
PropagateCommit always errors
func (*MockPfsPropagater) Run ¶ added in v1.9.10
func (mpp *MockPfsPropagater) Run() error
Run always errors
type MockPfsTransactionServer ¶ added in v1.9.10
type MockPfsTransactionServer struct{}
MockPfsTransactionServer is a simple mock that can be used to satisfy the PfsTransactionServer interface
func NewMockPfsTransactionServer ¶ added in v1.9.10
func NewMockPfsTransactionServer() *MockPfsTransactionServer
NewMockPfsTransactionServer instantiates a MockPfsTransactionServer
func (*MockPfsTransactionServer) CreateBranchInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) CreateBranchInTransaction(*TransactionContext, *pfs.CreateBranchRequest) error
CreateBranchInTransaction always errors
func (*MockPfsTransactionServer) CreateRepoInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) CreateRepoInTransaction(*TransactionContext, *pfs.CreateRepoRequest) error
CreateRepoInTransaction always errors
func (*MockPfsTransactionServer) DeleteBranchInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) DeleteBranchInTransaction(*TransactionContext, *pfs.DeleteBranchRequest) error
DeleteBranchInTransaction always errors
func (*MockPfsTransactionServer) DeleteCommitInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) DeleteCommitInTransaction(*TransactionContext, *pfs.DeleteCommitRequest) error
DeleteCommitInTransaction always errors
func (*MockPfsTransactionServer) DeleteRepoInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) DeleteRepoInTransaction(*TransactionContext, *pfs.DeleteRepoRequest) error
DeleteRepoInTransaction always errors
func (*MockPfsTransactionServer) FinishCommitInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) FinishCommitInTransaction(*TransactionContext, *pfs.FinishCommitRequest) error
FinishCommitInTransaction always errors
func (*MockPfsTransactionServer) InspectRepoInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) InspectRepoInTransaction(*TransactionContext, *pfs.InspectRepoRequest) (*pfs.RepoInfo, error)
InspectRepoInTransaction always errors
func (*MockPfsTransactionServer) NewPropagater ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) NewPropagater(col.STM) PfsPropagater
NewPropagater returns a MockPfsPropagater
func (*MockPfsTransactionServer) StartCommitInTransaction ¶ added in v1.9.10
func (mpts *MockPfsTransactionServer) StartCommitInTransaction(*TransactionContext, *pfs.StartCommitRequest, *pfs.Commit) (*pfs.Commit, error)
StartCommitInTransaction always errors
type MockPpsTransactionServer ¶ added in v1.9.11
type MockPpsTransactionServer struct{}
MockPpsTransactionServer is a simple mock that can be used to satisfy the PpsTransactionServer interface
func NewMockPpsTransactionServer ¶ added in v1.9.11
func NewMockPpsTransactionServer() *MockPpsTransactionServer
NewMockPpsTransactionServer instantiates a MockPpsTransactionServer
func (*MockPpsTransactionServer) UpdateJobStateInTransaction ¶ added in v1.9.11
func (mpts *MockPpsTransactionServer) UpdateJobStateInTransaction(*TransactionContext, *pps.UpdateJobStateRequest) error
UpdateJobStateInTransaction always errors
type PfsPropagater ¶
type PfsPropagater interface { PropagateCommit(branch *pfs.Branch, isNewCommit bool) error Run() error }
PfsPropagater is the interface that PFS implements to propagate commits at the end of a transaction. It is defined here to avoid a circular dependency.
type PfsTransactionServer ¶
type PfsTransactionServer interface { NewPropagater(col.STM) PfsPropagater CreateRepoInTransaction(*TransactionContext, *pfs.CreateRepoRequest) error InspectRepoInTransaction(*TransactionContext, *pfs.InspectRepoRequest) (*pfs.RepoInfo, error) DeleteRepoInTransaction(*TransactionContext, *pfs.DeleteRepoRequest) error StartCommitInTransaction(*TransactionContext, *pfs.StartCommitRequest, *pfs.Commit) (*pfs.Commit, error) FinishCommitInTransaction(*TransactionContext, *pfs.FinishCommitRequest) error DeleteCommitInTransaction(*TransactionContext, *pfs.DeleteCommitRequest) error CreateBranchInTransaction(*TransactionContext, *pfs.CreateBranchRequest) error DeleteBranchInTransaction(*TransactionContext, *pfs.DeleteBranchRequest) error }
PfsTransactionServer is an interface for the transactionally-supported methods that can be called through the PFS server.
type PfsWrites ¶
type PfsWrites interface { CreateRepo(*pfs.CreateRepoRequest) error DeleteRepo(*pfs.DeleteRepoRequest) error StartCommit(*pfs.StartCommitRequest, *pfs.Commit) (*pfs.Commit, error) FinishCommit(*pfs.FinishCommitRequest) error DeleteCommit(*pfs.DeleteCommitRequest) error CreateBranch(*pfs.CreateBranchRequest) error DeleteBranch(*pfs.DeleteBranchRequest) error }
PfsWrites is an interface providing a wrapper for each operation that may be appended to a transaction through PFS. Each call may either directly run the request through PFS or append it to the active transaction, depending on if there is an active transaction in the client context.
type PpsTransactionServer ¶ added in v1.9.11
type PpsTransactionServer interface {
UpdateJobStateInTransaction(*TransactionContext, *pps.UpdateJobStateRequest) error
}
PpsTransactionServer is an interface for the transactionally-supported methods that can be called through the PPS server.
type PpsWrites ¶ added in v1.9.11
type PpsWrites interface {
UpdateJobState(*pps.UpdateJobStateRequest) error
}
PpsWrites is an interface providing a wrapper for each operation that may be appended to a transaction through PPS. Each call may either directly run the request through PPS or append it to the active transaction, depending on if there is an active transaction in the client context.
type Transaction ¶
type Transaction interface { PfsWrites PpsWrites AuthWrites }
Transaction is an interface to unify the code that may either perform an action directly or append an action to an existing transaction (depending on if there is an active transaction in the client context metadata). There are two implementations of this interface:
directTransaction: all operations will be run directly through the relevant server, all inside the same STM. appendTransaction: all operations will be appended to the active transaction which will then be dryrun so that the response for the operation can be returned. Each operation that is appended will do a new dryrun, so this isn't as efficient as it could be.
func NewDirectTransaction ¶
func NewDirectTransaction(txnCtx *TransactionContext) Transaction
NewDirectTransaction is a helper function to instantiate a directTransaction object. It is exposed so that the transaction API server can run a direct transaction even though there is an active transaction in the context (which is why it cannot use `WithTransaction`).
type TransactionContext ¶
type TransactionContext struct { ClientContext context.Context Client *client.APIClient Stm col.STM // contains filtered or unexported fields }
TransactionContext is a helper type to encapsulate the state for a given set of operations being performed in the Pachyderm API. When a new transaction is started, a context will be created for it containing these objects, which will be threaded through to every API call:
ctx: the client context which initiated the operations being performed pachClient: the APIClient associated with the client context ctx stm: the object that controls transactionality with etcd. This is to ensure that all reads and writes are consistent until changes are committed. txnEnv: a struct containing references to each API server, it can be used to make calls to other API servers (e.g. checking auth permissions) pfsDefer: an interface for ensuring certain PFS cleanup tasks are performed properly (and deduped) at the end of the transaction.
func (*TransactionContext) Auth ¶
func (t *TransactionContext) Auth() AuthTransactionServer
Auth returns a reference to the Auth API Server so that transactionally- supported methods can be called across the API boundary without using RPCs (which will not maintain transactional guarantees)
func (*TransactionContext) Pfs ¶
func (t *TransactionContext) Pfs() PfsTransactionServer
Pfs returns a reference to the PFS API Server so that transactionally- supported methods can be called across the API boundary without using RPCs (which will not maintain transactional guarantees)
func (*TransactionContext) PropagateCommit ¶
func (t *TransactionContext) PropagateCommit(branch *pfs.Branch, isNewCommit bool) error
PropagateCommit saves a branch to be propagated at the end of the transaction (if all operations complete successfully). This is used to batch together propagations and dedupe downstream commits in PFS.
type TransactionEnv ¶
type TransactionEnv struct {
// contains filtered or unexported fields
}
TransactionEnv contains the APIServer instances for each subsystem that may be involved in running transactions so that they can make calls to each other without leaving the context of a transaction. This is a separate object because there are cyclic dependencies between APIServer instances.
func (*TransactionEnv) Initialize ¶
func (env *TransactionEnv) Initialize( serviceEnv *serviceenv.ServiceEnv, txnServer TransactionServer, authServer AuthTransactionServer, pfsServer PfsTransactionServer, ppsServer PpsTransactionServer, )
Initialize stores the references to APIServer instances in the TransactionEnv
func (*TransactionEnv) WithReadContext ¶
func (env *TransactionEnv) WithReadContext(ctx context.Context, cb func(*TransactionContext) error) error
WithReadContext will call the given callback with a TransactionContext which can be used to perform reads of the current cluster state. If the transaction is used to perform any writes, they will be silently discarded.
func (*TransactionEnv) WithTransaction ¶
func (env *TransactionEnv) WithTransaction(ctx context.Context, cb func(Transaction) error) error
WithTransaction will call the given callback with a txnenv.Transaction object, which is instantiated differently based on if an active transaction is present in the RPC context. If an active transaction is present, any calls into the Transaction are first dry-run then appended to the transaction. If there is no active transaction, the request will be run directly through the selected server.
func (*TransactionEnv) WithWriteContext ¶
func (env *TransactionEnv) WithWriteContext(ctx context.Context, cb func(*TransactionContext) error) error
WithWriteContext will call the given callback with a TransactionContext which can be used to perform reads and writes on the current cluster state.
type TransactionServer ¶
type TransactionServer interface { AppendRequest( context.Context, *transaction.Transaction, *transaction.TransactionRequest, ) (*transaction.TransactionResponse, error) }
TransactionServer is an interface used by other servers to append a request to an existing transaction.