Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions sync/owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import (
)

const (
// Store/Database name for the ownership table
ownerShipDatabase = "sync"

// collection name for sync ownership table
ownerShipCollection = "owner-table"

Expand Down Expand Up @@ -197,3 +200,14 @@ func InitializeOwnerWithUpdateInterval(ctx context.Context, store db.Store, name
// allocate owner entry context
return ownerTable.allocateOwner(name)
}

// Initialize the Sync Owner management constructs, anyone while working with
// this library requires to use this function before actually start consuming
// any functionality from here.
// This function falls back to using the default database, ensuring common
// definition for all the consuming processes to ensure synchronisation to work
// in a seemless manner
func InitializeOwnerTableDefault(ctx context.Context, client db.StoreClient, name string) error {
store := client.GetDataStore(ownerShipDatabase)
return InitializeOwnerWithUpdateInterval(ctx, store, name, defaultOwnerUpdateInterval)
}