-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- putting options for XDCR in sg-bucket allows full XDCR implementation to be in rosmar - place sync metadata constants into sg-bucket for rosmar - merge GetCollectionID()/DataStoreName() into DataStore to avoid extra casting.
- Loading branch information
Showing
3 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package sgbucket | ||
|
||
const ( | ||
SyncDocPrefix = "_sync:" // SyncDocPrefix is a document prefix for all sync metadata | ||
Att2Prefix = SyncDocPrefix + "att2:" // Att2Prefix is a document prefix for v2 attachment data | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package sgbucket | ||
|
||
import "context" | ||
|
||
// XDCRStats represents the stats of a replication. | ||
type XDCRStats struct { | ||
// DocsFiltered is the number of documents that have been filtered out and have not been replicated to the target cluster. | ||
DocsFiltered uint64 | ||
// DocsWritten is the number of documents written to the destination cluster, since the start or resumption of the current replication. | ||
DocsWritten uint64 | ||
} | ||
|
||
// XDCR represents a bucket to bucket XDCR replication. | ||
type XDCR interface { | ||
// Start starts the replication. | ||
Start(context.Context) error | ||
// Stop terminates the replication. | ||
Stop(context.Context) error | ||
// Stats returns the stats for the replication. | ||
Stats(context.Context) (*XDCRStats, error) | ||
} | ||
|
||
// XDcrManager represents the presence of "-mobile" flag for Couchbase Server replications. -mobile implies filtering sync metadata, handling version vectors, and filtering sync documents. | ||
type XDCRMobileSetting uint8 | ||
|
||
const ( | ||
XDCRMobileOff = iota | ||
XDCRMobileOn | ||
) | ||
|
||
// String returns the string representation of the XDCRMobileSetting, used for directly passing on to the Couchbase Server REST API. | ||
func (s XDCRMobileSetting) String() string { | ||
switch s { | ||
case XDCRMobileOff: | ||
return "Off" | ||
case XDCRMobileOn: | ||
return "Active" | ||
default: | ||
return "Unknown" | ||
} | ||
} | ||
|
||
// XDCROptions represents the options for creating an XDCR. | ||
type XDCROptions struct { | ||
// FilterExpression is the filter expression to use for the replication. | ||
FilterExpression string | ||
// XDCR mobile setting defines whether XDCR replication will use -mobile setting behavior in Couchbase Server. | ||
Mobile XDCRMobileSetting | ||
} |