Documentation
¶
Index ¶
- Constants
- func ValidateConfig(class *models.Class) error
- func ValidateConfigUpdate(old, updated *models.Class, nodeCounter nodeCounter) error
- type Client
- type ConsistencyLevel
- type DeleteBatchResponse
- type Error
- type Finder
- func (f *Finder) Exists(ctx context.Context, l ConsistencyLevel, shard string, id strfmt.UUID) (bool, error)
- func (f *Finder) GetAll(ctx context.Context, l ConsistencyLevel, shard string, ids []strfmt.UUID) ([]*storobj.Object, 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 RClient
- 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, docIDs []uint64, ...) 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 RemoteReplicaIncomingRepo
- 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, docIDs []uint64, 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 SimpleResponse
- type StatusCode
- type UUID2Error
- type WClient
Constants ¶
View Source
const ( StatusOK = 0 StatusClassNotFound = iota + 200 StatusShardNotFound StatusNotFound StatusAlreadyExisted StatusNotReady StatusConflict = iota + 300 StatusPreconditionFailed StatusReadOnly )
View Source
const (
// RequestKey is used to marshalling request IDs
RequestKey = "request_id"
)
Variables ¶
This section is empty.
Functions ¶
func ValidateConfig ¶
func ValidateConfigUpdate ¶
Types ¶
type ConsistencyLevel ¶
type ConsistencyLevel string
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 happing 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, stateGetter shardingState, nodeResolver nodeResolver, client RClient, l logrus.FieldLogger, ) *Finder
NewFinder constructs a new finder instance
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) GetAll ¶ added in v1.18.0
func (f *Finder) GetAll(ctx context.Context, l ConsistencyLevel, shard string, ids []strfmt.UUID, ) ([]*storobj.Object, error)
GetAll gets all objects which satisfy the giving consistency
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 RClient ¶
type RClient interface {
// FetchObject fetches one object
FetchObject(_ context.Context, host, index, shard string,
id strfmt.UUID, props search.SelectProperties,
additional additional.Properties) (objects.Replica, error)
// FetchObjects fetches objects specified in ids list.
FetchObjects(_ context.Context, host, index, shard string,
ids []strfmt.UUID) ([]objects.Replica, error)
// OverwriteObjects conditionally updates existing objects.
OverwriteObjects(_ context.Context, host, index, shard string,
_ []*objects.VObject) ([]RepairResponse, error)
// DigestObjects finds a list of objects and returns a compact representation
// of a list of the objects. This is used by the replicator to optimize the
// number of bytes transferred over the network when fetching a replicated
// object
DigestObjects(ctx context.Context, host, index, shard string,
ids []strfmt.UUID) ([]RepairResponse, error)
}
RClient is the client used to read from remote replicas
type RemoteReplicaIncoming ¶
type RemoteReplicaIncoming struct {
// contains filtered or unexported fields
}
func NewRemoteReplicaIncoming ¶
func NewRemoteReplicaIncoming(repo RemoteReplicaIncomingRepo) *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, docIDs []uint64, 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 RemoteReplicaIncomingRepo ¶
type RemoteReplicaIncomingRepo 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, docIDs []uint64, 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 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, docIDs []uint64, 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
type UUID2Error ¶
type WClient ¶ added in v1.18.0
type WClient interface {
PutObject(ctx context.Context, host, index, shard, requestID string,
obj *storobj.Object) (SimpleResponse, error)
DeleteObject(ctx context.Context, host, index, shard, requestID string,
id strfmt.UUID) (SimpleResponse, error)
PutObjects(ctx context.Context, host, index, shard, requestID string,
objs []*storobj.Object) (SimpleResponse, error)
MergeObject(ctx context.Context, host, index, shard, requestID string,
mergeDoc *objects.MergeDocument) (SimpleResponse, error)
DeleteObjects(ctx context.Context, host, index, shard, requestID string,
docIDs []uint64, dryRun bool) (SimpleResponse, error)
AddReferences(ctx context.Context, host, index, shard, requestID string,
refs []objects.BatchReference) (SimpleResponse, error)
Commit(ctx context.Context, host, index, shard, requestID string, resp interface{}) error
Abort(ctx context.Context, host, index, shard, requestID string) (SimpleResponse, error)
}
Click to show internal directories.
Click to hide internal directories.