Documentation ¶
Index ¶
- Constants
- func ValidateConfig(class *models.Class, globalCfg replication.GlobalConfig) error
- func ValidateConfigUpdate(old, updated *models.Class, nodeCounter nodeCounter) error
- type Client
- type ConsistencyLevel
- type DeleteBatchResponse
- type Error
- type Finder
- func (f *Finder) CheckConsistency(ctx context.Context, l ConsistencyLevel, xs []*storobj.Object) (retErr error)
- func (f *Finder) Exists(ctx context.Context, l ConsistencyLevel, shard string, id strfmt.UUID) (bool, error)
- func (f *Finder) FindUUIDs(ctx context.Context, className, shard string, filters *filters.LocalFilter, ...) (uuids []strfmt.UUID, err error)
- func (f *Finder) GetOne(ctx context.Context, l ConsistencyLevel, shard string, id strfmt.UUID, ...) (*storobj.Object, error)
- func (f *Finder) NodeObject(ctx context.Context, nodeName, shard string, id strfmt.UUID, ...) (*storobj.Object, error)
- type RemoteIncomingRepo
- type RemoteReplicaIncoming
- func (rri *RemoteReplicaIncoming) AbortReplication(indexName, shardName, requestID string) interface{}
- func (rri *RemoteReplicaIncoming) CommitReplication(indexName, shardName, requestID string) interface{}
- func (rri *RemoteReplicaIncoming) DigestObjects(ctx context.Context, indexName, shardName string, ids []strfmt.UUID) (result []RepairResponse, err error)
- func (rri *RemoteReplicaIncoming) FetchObject(ctx context.Context, indexName, shardName string, id strfmt.UUID) (objects.Replica, error)
- func (rri *RemoteReplicaIncoming) FetchObjects(ctx context.Context, indexName, shardName string, ids []strfmt.UUID) ([]objects.Replica, error)
- func (rri *RemoteReplicaIncoming) OverwriteObjects(ctx context.Context, indexName, shardName string, vobjects []*objects.VObject) ([]RepairResponse, error)
- func (rri *RemoteReplicaIncoming) ReplicateDeletion(ctx context.Context, indexName, shardName, requestID string, uuid strfmt.UUID) SimpleResponse
- func (rri *RemoteReplicaIncoming) ReplicateDeletions(ctx context.Context, indexName, shardName, requestID string, ...) SimpleResponse
- func (rri *RemoteReplicaIncoming) ReplicateObject(ctx context.Context, indexName, shardName, requestID string, ...) SimpleResponse
- func (rri *RemoteReplicaIncoming) ReplicateObjects(ctx context.Context, indexName, shardName, requestID string, ...) SimpleResponse
- func (rri *RemoteReplicaIncoming) ReplicateReferences(ctx context.Context, indexName, shardName, requestID string, ...) SimpleResponse
- func (rri *RemoteReplicaIncoming) ReplicateUpdate(ctx context.Context, indexName, shardName, requestID string, ...) SimpleResponse
- type RepairResponse
- type Replicator
- func (r *Replicator) AddReferences(ctx context.Context, shard string, refs []objects.BatchReference, ...) []error
- func (r *Replicator) DeleteObject(ctx context.Context, shard string, id strfmt.UUID, l ConsistencyLevel) error
- func (r *Replicator) DeleteObjects(ctx context.Context, shard string, uuids []strfmt.UUID, dryRun bool, ...) []objects.BatchSimpleObject
- func (r *Replicator) MergeObject(ctx context.Context, shard string, doc *objects.MergeDocument, ...) error
- func (r *Replicator) PutObject(ctx context.Context, shard string, obj *storobj.Object, l ConsistencyLevel) error
- func (r *Replicator) PutObjects(ctx context.Context, shard string, objs []*storobj.Object, l ConsistencyLevel) []error
- type ShardDesc
- type SimpleResponse
- type StatusCode
- type UUID2Error
Constants ¶
const ( StatusOK = 0 StatusClassNotFound = iota + 200 StatusShardNotFound StatusNotFound StatusAlreadyExisted StatusNotReady StatusConflict = iota + 300 StatusPreconditionFailed StatusReadOnly StatusObjectNotFound )
const (
// RequestKey is used to marshalling request IDs
RequestKey = "request_id"
)
Variables ¶
This section is empty.
Functions ¶
func ValidateConfig ¶
func ValidateConfig(class *models.Class, globalCfg replication.GlobalConfig) error
func ValidateConfigUpdate ¶
Types ¶
type Client ¶
type Client interface {
// contains filtered or unexported methods
}
Client is used to read and write objects on replicas
type ConsistencyLevel ¶
type ConsistencyLevel string
ConsistencyLevel is an enum of all possible consistency level
const ( One ConsistencyLevel = "ONE" Quorum ConsistencyLevel = "QUORUM" All ConsistencyLevel = "ALL" )
type DeleteBatchResponse ¶
type DeleteBatchResponse struct {
Batch []UUID2Error `json:"batch,omitempty"`
}
DeleteBatchResponse represents the response returned by DeleteObjects
func (*DeleteBatchResponse) FirstError ¶
func (r *DeleteBatchResponse) FirstError() error
FirstError returns the first found error
type Error ¶
type Error struct { Code StatusCode `json:"code"` Msg string `json:"msg,omitempty"` Err error `json:"-"` }
Error reports error happening during replication
func NewError ¶
func NewError(code StatusCode, msg string) *Error
NewError create new replication error
func (*Error) IsStatusCode ¶
func (e *Error) IsStatusCode(sc StatusCode) bool
type Finder ¶
type Finder struct {
// contains filtered or unexported fields
}
Finder finds replicated objects
func NewFinder ¶
func NewFinder(className string, resolver *resolver, client rClient, l logrus.FieldLogger, coordinatorPullBackoffInitialInterval time.Duration, coordinatorPullBackoffMaxElapsedTime time.Duration, ) *Finder
NewFinder constructs a new finder instance
func (*Finder) CheckConsistency ¶ added in v1.19.0
func (f *Finder) CheckConsistency(ctx context.Context, l ConsistencyLevel, xs []*storobj.Object, ) (retErr error)
CheckConsistency for objects belonging to different physical shards.
For each x in xs the fields BelongsToNode and BelongsToShard must be set non empty
func (*Finder) Exists ¶ added in v1.18.0
func (f *Finder) Exists(ctx context.Context, l ConsistencyLevel, shard string, id strfmt.UUID, ) (bool, error)
Exists checks if an object exists which satisfies the giving consistency
func (*Finder) FindUUIDs ¶ added in v1.24.18
func (f *Finder) FindUUIDs(ctx context.Context, className, shard string, filters *filters.LocalFilter, l ConsistencyLevel, ) (uuids []strfmt.UUID, err error)
func (*Finder) GetOne ¶ added in v1.18.0
func (f *Finder) GetOne(ctx context.Context, l ConsistencyLevel, shard string, id strfmt.UUID, props search.SelectProperties, adds additional.Properties, ) (*storobj.Object, error)
GetOne gets object which satisfies the giving consistency
func (*Finder) NodeObject ¶
func (f *Finder) NodeObject(ctx context.Context, nodeName, shard string, id strfmt.UUID, props search.SelectProperties, adds additional.Properties, ) (*storobj.Object, error)
NodeObject gets object from a specific node. it is used mainly for debugging purposes
type RemoteIncomingRepo ¶ added in v1.19.0
type RemoteIncomingRepo interface { // Write endpoints ReplicateObject(ctx context.Context, indexName, shardName, requestID string, object *storobj.Object) SimpleResponse ReplicateObjects(ctx context.Context, indexName, shardName, requestID string, objects []*storobj.Object) SimpleResponse ReplicateUpdate(ctx context.Context, indexName, shardName, requestID string, mergeDoc *objects.MergeDocument) SimpleResponse ReplicateDeletion(ctx context.Context, indexName, shardName, requestID string, uuid strfmt.UUID) SimpleResponse ReplicateDeletions(ctx context.Context, indexName, shardName, requestID string, uuids []strfmt.UUID, dryRun bool) SimpleResponse ReplicateReferences(ctx context.Context, indexName, shardName, requestID string, refs []objects.BatchReference) SimpleResponse CommitReplication(indexName, shardName, requestID string) interface{} AbortReplication(indexName, shardName, requestID string) interface{} OverwriteObjects(ctx context.Context, index, shard string, vobjects []*objects.VObject) ([]RepairResponse, error) // Read endpoints FetchObject(ctx context.Context, indexName, shardName string, id strfmt.UUID) (objects.Replica, error) FetchObjects(ctx context.Context, class, shardName string, ids []strfmt.UUID) ([]objects.Replica, error) DigestObjects(ctx context.Context, class, shardName string, ids []strfmt.UUID) (result []RepairResponse, err error) }
type RemoteReplicaIncoming ¶
type RemoteReplicaIncoming struct {
// contains filtered or unexported fields
}
func NewRemoteReplicaIncoming ¶
func NewRemoteReplicaIncoming(repo RemoteIncomingRepo) *RemoteReplicaIncoming
func (*RemoteReplicaIncoming) AbortReplication ¶
func (rri *RemoteReplicaIncoming) AbortReplication(indexName, shardName, requestID string, ) interface{}
func (*RemoteReplicaIncoming) CommitReplication ¶
func (rri *RemoteReplicaIncoming) CommitReplication(indexName, shardName, requestID string, ) interface{}
func (*RemoteReplicaIncoming) DigestObjects ¶ added in v1.18.0
func (rri *RemoteReplicaIncoming) DigestObjects(ctx context.Context, indexName, shardName string, ids []strfmt.UUID, ) (result []RepairResponse, err error)
func (*RemoteReplicaIncoming) FetchObject ¶ added in v1.18.0
func (*RemoteReplicaIncoming) FetchObjects ¶ added in v1.18.0
func (*RemoteReplicaIncoming) OverwriteObjects ¶ added in v1.18.0
func (rri *RemoteReplicaIncoming) OverwriteObjects(ctx context.Context, indexName, shardName string, vobjects []*objects.VObject, ) ([]RepairResponse, error)
func (*RemoteReplicaIncoming) ReplicateDeletion ¶
func (rri *RemoteReplicaIncoming) ReplicateDeletion(ctx context.Context, indexName, shardName, requestID string, uuid strfmt.UUID, ) SimpleResponse
func (*RemoteReplicaIncoming) ReplicateDeletions ¶
func (rri *RemoteReplicaIncoming) ReplicateDeletions(ctx context.Context, indexName, shardName, requestID string, uuids []strfmt.UUID, dryRun bool, ) SimpleResponse
func (*RemoteReplicaIncoming) ReplicateObject ¶
func (rri *RemoteReplicaIncoming) ReplicateObject(ctx context.Context, indexName, shardName, requestID string, object *storobj.Object, ) SimpleResponse
func (*RemoteReplicaIncoming) ReplicateObjects ¶
func (rri *RemoteReplicaIncoming) ReplicateObjects(ctx context.Context, indexName, shardName, requestID string, objects []*storobj.Object, ) SimpleResponse
func (*RemoteReplicaIncoming) ReplicateReferences ¶
func (rri *RemoteReplicaIncoming) ReplicateReferences(ctx context.Context, indexName, shardName, requestID string, refs []objects.BatchReference, ) SimpleResponse
func (*RemoteReplicaIncoming) ReplicateUpdate ¶
func (rri *RemoteReplicaIncoming) ReplicateUpdate(ctx context.Context, indexName, shardName, requestID string, mergeDoc *objects.MergeDocument, ) SimpleResponse
type RepairResponse ¶ added in v1.18.0
type Replicator ¶
type Replicator struct { *Finder // contains filtered or unexported fields }
func NewReplicator ¶
func NewReplicator(className string, stateGetter shardingState, nodeResolver nodeResolver, client Client, l logrus.FieldLogger, ) *Replicator
func (*Replicator) AddReferences ¶
func (r *Replicator) AddReferences(ctx context.Context, shard string, refs []objects.BatchReference, l ConsistencyLevel, ) []error
func (*Replicator) DeleteObject ¶
func (r *Replicator) DeleteObject(ctx context.Context, shard string, id strfmt.UUID, l ConsistencyLevel, ) error
func (*Replicator) DeleteObjects ¶
func (r *Replicator) DeleteObjects(ctx context.Context, shard string, uuids []strfmt.UUID, dryRun bool, l ConsistencyLevel, ) []objects.BatchSimpleObject
func (*Replicator) MergeObject ¶
func (r *Replicator) MergeObject(ctx context.Context, shard string, doc *objects.MergeDocument, l ConsistencyLevel, ) error
func (*Replicator) PutObject ¶
func (r *Replicator) PutObject(ctx context.Context, shard string, obj *storobj.Object, l ConsistencyLevel, ) error
func (*Replicator) PutObjects ¶
func (r *Replicator) PutObjects(ctx context.Context, shard string, objs []*storobj.Object, l ConsistencyLevel, ) []error
type SimpleResponse ¶
type SimpleResponse struct {
Errors []Error `json:"errors,omitempty"`
}
func (*SimpleResponse) FirstError ¶
func (r *SimpleResponse) FirstError() error
type StatusCode ¶
type StatusCode int
StatusCode is communicate the cause of failure during replication