MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / validateSyncDataForImport

Method validateSyncDataForImport

db/document.go:627–634  ·  view source on GitHub ↗

validateSyncDataForImport validates for a non-empty sync data that the sync data is valid for import. If s=ofund to not be valid will return HTTP error 422 (Unprocessable Entity) and increment the import error count.

(ctx context.Context, db *DatabaseContext, docID string)

Source from the content-addressed store, hash-verified

625// validateSyncDataForImport validates for a non-empty sync data that the sync data is valid for import. If s=ofund to
626// not be valid will return HTTP error 422 (Unprocessable Entity) and increment the import error count.
627func (s *SyncData) validateSyncDataForImport(ctx context.Context, db *DatabaseContext, docID string) error {
628 if !s.SyncIsEmpty() && !s.HasValidSyncData() {
629 base.WarnfCtx(ctx, "Invalid sync data for doc %s - not importing.", base.UD(docID))
630 db.DbStats.SharedBucketImportStats.ImportErrorCount.Add(1)
631 return base.HTTPErrorf(http.StatusNotFound, "Not imported, invalid sync data found")
632 }
633 return nil
634}
635
636func (s *SyncData) SyncIsEmpty() bool {
637 if s == nil {

Callers 2

OnDemandImportForGetMethod · 0.80

Calls 6

SyncIsEmptyMethod · 0.95
HasValidSyncDataMethod · 0.95
WarnfCtxFunction · 0.92
UDFunction · 0.92
HTTPErrorfFunction · 0.92
AddMethod · 0.45

Tested by

no test coverage detected