Spaces:
Running
Running
File size: 4,951 Bytes
b110593 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
// _ _
// __ _____ __ ___ ___ __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
// \ V V / __/ (_| |\ V /| | (_| | || __/
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
// Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
//
// CONTACT: [email protected]
//
package replica
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/weaviate/weaviate/entities/storobj"
"github.com/weaviate/weaviate/usecases/objects"
)
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 struct {
repo RemoteIncomingRepo
}
func NewRemoteReplicaIncoming(repo RemoteIncomingRepo) *RemoteReplicaIncoming {
return &RemoteReplicaIncoming{
repo: repo,
}
}
func (rri *RemoteReplicaIncoming) ReplicateObject(ctx context.Context, indexName,
shardName, requestID string, object *storobj.Object,
) SimpleResponse {
return rri.repo.ReplicateObject(ctx, indexName, shardName, requestID, object)
}
func (rri *RemoteReplicaIncoming) ReplicateObjects(ctx context.Context, indexName,
shardName, requestID string, objects []*storobj.Object,
) SimpleResponse {
return rri.repo.ReplicateObjects(ctx, indexName, shardName, requestID, objects)
}
func (rri *RemoteReplicaIncoming) ReplicateUpdate(ctx context.Context, indexName,
shardName, requestID string, mergeDoc *objects.MergeDocument,
) SimpleResponse {
return rri.repo.ReplicateUpdate(ctx, indexName, shardName, requestID, mergeDoc)
}
func (rri *RemoteReplicaIncoming) ReplicateDeletion(ctx context.Context, indexName,
shardName, requestID string, uuid strfmt.UUID,
) SimpleResponse {
return rri.repo.ReplicateDeletion(ctx, indexName, shardName, requestID, uuid)
}
func (rri *RemoteReplicaIncoming) ReplicateDeletions(ctx context.Context, indexName,
shardName, requestID string, uuids []strfmt.UUID, dryRun bool,
) SimpleResponse {
return rri.repo.ReplicateDeletions(ctx, indexName, shardName, requestID, uuids, dryRun)
}
func (rri *RemoteReplicaIncoming) ReplicateReferences(ctx context.Context, indexName,
shardName, requestID string, refs []objects.BatchReference,
) SimpleResponse {
return rri.repo.ReplicateReferences(ctx, indexName, shardName, requestID, refs)
}
func (rri *RemoteReplicaIncoming) CommitReplication(indexName,
shardName, requestID string,
) interface{} {
return rri.repo.CommitReplication(indexName, shardName, requestID)
}
func (rri *RemoteReplicaIncoming) AbortReplication(indexName,
shardName, requestID string,
) interface{} {
return rri.repo.AbortReplication(indexName, shardName, requestID)
}
func (rri *RemoteReplicaIncoming) OverwriteObjects(ctx context.Context,
indexName, shardName string, vobjects []*objects.VObject,
) ([]RepairResponse, error) {
return rri.repo.OverwriteObjects(ctx, indexName, shardName, vobjects)
}
func (rri *RemoteReplicaIncoming) FetchObject(ctx context.Context,
indexName, shardName string, id strfmt.UUID,
) (objects.Replica, error) {
return rri.repo.FetchObject(ctx, indexName, shardName, id)
}
func (rri *RemoteReplicaIncoming) FetchObjects(ctx context.Context,
indexName, shardName string, ids []strfmt.UUID,
) ([]objects.Replica, error) {
return rri.repo.FetchObjects(ctx, indexName, shardName, ids)
}
func (rri *RemoteReplicaIncoming) DigestObjects(ctx context.Context,
indexName, shardName string, ids []strfmt.UUID,
) (result []RepairResponse, err error) {
return rri.repo.DigestObjects(ctx, indexName, shardName, ids)
}
|