Documentation
¶
Index ¶
- Variables
- type RollbackInterface
- type TargetSourceReplace
- type Transaction
- func (t *Transaction) AddIntentContent(name string, tit TransactionIntentType, priority int32, ...) error
- func (t *Transaction) AddTransactionIntent(ti *TransactionIntent, tit TransactionIntentType) error
- func (t *Transaction) AddTransactionIntents(ti []*TransactionIntent, tit TransactionIntentType) error
- func (t *Transaction) Confirm() error
- func (t *Transaction) GetIntentNames() []string
- func (t *Transaction) GetNewIntents() map[string]*TransactionIntent
- func (t *Transaction) GetOldRunning() *TransactionIntent
- func (t *Transaction) GetPathSet(tit TransactionIntentType) *treetypes.PathSet
- func (t *Transaction) GetReplace() *TransactionIntent
- func (t *Transaction) GetRollbackTransaction() *Transaction
- func (t *Transaction) GetTransactionId() string
- func (t *Transaction) IntentCount() int
- func (t *Transaction) IsNoOp() bool
- func (t *Transaction) IsRollback() bool
- func (t *Transaction) SetReplace(ti *TransactionIntent)
- func (t *Transaction) SetTimeout(d time.Duration)
- func (t *Transaction) StartRollbackTimer() error
- type TransactionCancelTimer
- type TransactionGuard
- type TransactionIntent
- func (ti *TransactionIntent) AddUpdate(u *treetypes.Update)
- func (ti *TransactionIntent) AddUpdates(u treetypes.UpdateSlice)
- func (ti *TransactionIntent) Deviation() bool
- func (ti *TransactionIntent) GetDeleteIgnoreNonExisting() bool
- func (ti *TransactionIntent) GetName() string
- func (ti *TransactionIntent) GetOnlyIntended() bool
- func (ti *TransactionIntent) GetPathSet() *treetypes.PathSet
- func (ti *TransactionIntent) GetPriority() int32
- func (ti *TransactionIntent) GetUpdates() treetypes.UpdateSlice
- func (ti *TransactionIntent) SetDeleteFlag()
- func (ti *TransactionIntent) SetDeleteIgnoreNonExisting()
- func (ti *TransactionIntent) SetDeleteOnlyIntendedFlag()
- func (ti *TransactionIntent) SetDeviation()
- type TransactionIntentType
- type TransactionManager
- func (t *TransactionManager) Cancel(ctx context.Context, id string) error
- func (t *TransactionManager) CleanupTransaction(id string) error
- func (t *TransactionManager) Confirm(id string) error
- func (t *TransactionManager) GetTransaction(id string) (*Transaction, error)
- func (t *TransactionManager) RegisterTransaction(ctx context.Context, trans *Transaction) (*TransactionGuard, error)
- func (t *TransactionManager) Rollback(ctx context.Context, trans *Transaction) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrTransactionOngoing error = errors.New("transaction ongoing")
)
Functions ¶
This section is empty.
Types ¶
type RollbackInterface ¶
type RollbackInterface interface {
TransactionRollback(ctx context.Context, transaction *Transaction, dryRun bool) (*sdcpb.TransactionSetResponse, error)
}
type TargetSourceReplace ¶
type TargetSourceReplace struct {
target.TargetSource
}
TargetSourceReplace takes a TargetSource and proxies the calls. Calls to ToProtoDeletes(...) [used with gnmi proto, json & json_ietf encodings] and ToXML(...) used in case of netconf are altered.
- ToProtoDeletes(...) returns only the root path.
- ToXML(...) returns the TargetSource generated etree.Document, but sets the replace flag on the root element
func NewTargetSourceReplace ¶
func NewTargetSourceReplace(ts target.TargetSource) *TargetSourceReplace
NewTargetSourceReplace constructor for TargetSourceReplace
func (*TargetSourceReplace) ToProtoDeletes ¶
ToProtoDeletes In the Replace case, we need to delete from the Root down. So the call is not forwarded to the TargetSource but the root path is returned
func (*TargetSourceReplace) ToXML ¶
func (t *TargetSourceReplace) ToXML(onlyNewOrUpdated bool, honorNamespace bool, operationWithNamespace bool, useOperationRemove bool) (*etree.Document, error)
ToXML in the XML case, we need to add the XMLReplace operation to the root element So the call is forwarded to the original TargetSource, the attribute is added and returned to the caller
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewTransaction ¶
func NewTransaction(id string, tm *TransactionManager) *Transaction
func (*Transaction) AddIntentContent ¶
func (t *Transaction) AddIntentContent(name string, tit TransactionIntentType, priority int32, content treetypes.UpdateSlice) error
AddIntentContent add the content of an intent. If the intent did not exist, add the name of the intent and content == nil.
func (*Transaction) AddTransactionIntent ¶
func (t *Transaction) AddTransactionIntent(ti *TransactionIntent, tit TransactionIntentType) error
func (*Transaction) AddTransactionIntents ¶
func (t *Transaction) AddTransactionIntents(ti []*TransactionIntent, tit TransactionIntentType) error
func (*Transaction) Confirm ¶
func (t *Transaction) Confirm() error
func (*Transaction) GetIntentNames ¶
func (t *Transaction) GetIntentNames() []string
func (*Transaction) GetNewIntents ¶
func (t *Transaction) GetNewIntents() map[string]*TransactionIntent
func (*Transaction) GetOldRunning ¶
func (t *Transaction) GetOldRunning() *TransactionIntent
func (*Transaction) GetPathSet ¶
func (t *Transaction) GetPathSet(tit TransactionIntentType) *treetypes.PathSet
func (*Transaction) GetReplace ¶
func (t *Transaction) GetReplace() *TransactionIntent
func (*Transaction) GetRollbackTransaction ¶
func (t *Transaction) GetRollbackTransaction() *Transaction
func (*Transaction) GetTransactionId ¶
func (t *Transaction) GetTransactionId() string
func (*Transaction) IntentCount ¶ added in v0.0.62
func (t *Transaction) IntentCount() int
func (*Transaction) IsNoOp ¶ added in v0.0.62
func (t *Transaction) IsNoOp() bool
func (*Transaction) IsRollback ¶
func (t *Transaction) IsRollback() bool
func (*Transaction) SetReplace ¶
func (t *Transaction) SetReplace(ti *TransactionIntent)
func (*Transaction) SetTimeout ¶
func (t *Transaction) SetTimeout(d time.Duration)
func (*Transaction) StartRollbackTimer ¶
func (t *Transaction) StartRollbackTimer() error
type TransactionCancelTimer ¶
type TransactionCancelTimer struct {
// contains filtered or unexported fields
}
func NewTransactionCancelTimer ¶
func NewTransactionCancelTimer(delay time.Duration, f func()) *TransactionCancelTimer
func (*TransactionCancelTimer) Start ¶
func (t *TransactionCancelTimer) Start() error
func (*TransactionCancelTimer) Stop ¶
func (t *TransactionCancelTimer) Stop()
type TransactionGuard ¶
type TransactionGuard struct {
// contains filtered or unexported fields
}
func NewTransactionGuard ¶
func NewTransactionGuard(cleanup func()) *TransactionGuard
NewTransactionGuard initializes the guard and ensures cleanup on function exit.
func (*TransactionGuard) Done ¶
func (tg *TransactionGuard) Done()
Done Ensure cleanup runs when the guard goes out of scope.
func (*TransactionGuard) Success ¶
func (tg *TransactionGuard) Success()
Success prevents the cleanup function from being called.
type TransactionIntent ¶
type TransactionIntent struct {
// contains filtered or unexported fields
}
func NewTransactionIntent ¶
func NewTransactionIntent(name string, priority int32) *TransactionIntent
func (*TransactionIntent) AddUpdate ¶
func (ti *TransactionIntent) AddUpdate(u *treetypes.Update)
func (*TransactionIntent) AddUpdates ¶
func (ti *TransactionIntent) AddUpdates(u treetypes.UpdateSlice)
func (*TransactionIntent) Deviation ¶ added in v0.0.62
func (ti *TransactionIntent) Deviation() bool
func (*TransactionIntent) GetDeleteIgnoreNonExisting ¶ added in v0.0.62
func (ti *TransactionIntent) GetDeleteIgnoreNonExisting() bool
func (*TransactionIntent) GetName ¶
func (ti *TransactionIntent) GetName() string
func (*TransactionIntent) GetOnlyIntended ¶
func (ti *TransactionIntent) GetOnlyIntended() bool
func (*TransactionIntent) GetPathSet ¶
func (ti *TransactionIntent) GetPathSet() *treetypes.PathSet
func (*TransactionIntent) GetPriority ¶
func (ti *TransactionIntent) GetPriority() int32
func (*TransactionIntent) GetUpdates ¶
func (ti *TransactionIntent) GetUpdates() treetypes.UpdateSlice
func (*TransactionIntent) SetDeleteFlag ¶
func (ti *TransactionIntent) SetDeleteFlag()
func (*TransactionIntent) SetDeleteIgnoreNonExisting ¶ added in v0.0.62
func (ti *TransactionIntent) SetDeleteIgnoreNonExisting()
func (*TransactionIntent) SetDeleteOnlyIntendedFlag ¶
func (ti *TransactionIntent) SetDeleteOnlyIntendedFlag()
func (*TransactionIntent) SetDeviation ¶ added in v0.0.62
func (ti *TransactionIntent) SetDeviation()
type TransactionIntentType ¶
type TransactionIntentType int
const ( TransactionIntentNew TransactionIntentType = iota // Starts at 0 TransactionIntentOld // Incremented to 1 )
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
func NewTransactionManager ¶
func NewTransactionManager(r RollbackInterface) *TransactionManager
func (*TransactionManager) Cancel ¶
func (t *TransactionManager) Cancel(ctx context.Context, id string) error
func (*TransactionManager) CleanupTransaction ¶
func (t *TransactionManager) CleanupTransaction(id string) error
cleanupTransaction the expectation is, that the caller is holding the lock for the TransactionManager
func (*TransactionManager) Confirm ¶
func (t *TransactionManager) Confirm(id string) error
func (*TransactionManager) GetTransaction ¶
func (t *TransactionManager) GetTransaction(id string) (*Transaction, error)
func (*TransactionManager) RegisterTransaction ¶
func (t *TransactionManager) RegisterTransaction(ctx context.Context, trans *Transaction) (*TransactionGuard, error)
func (*TransactionManager) Rollback ¶
func (t *TransactionManager) Rollback(ctx context.Context, trans *Transaction) error