storage

package
v1.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 22 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteStoredData

func DeleteStoredData(store Storage, metaData common.MetaData) common.SyncServiceError

DeleteStoredData calls the storage to delete the object's data

func DeleteStoredObject

func DeleteStoredObject(store Storage, metaData common.MetaData) common.SyncServiceError

DeleteStoredObject calls the storage to delete the object and its data

func IsDiscarded

func IsDiscarded(err error) bool

IsDiscarded returns true if the error passed in is the storage.Discarded error

func IsNotConnected

func IsNotConnected(err error) bool

IsNotConnected returns true if the error passed in is the storage.NotConnected error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error passed in is the storage.NotFound error

Types

type BoltStorage

type BoltStorage struct {
	// contains filtered or unexported fields
}

BoltStorage is a Bolt based store

func (*BoltStorage) ActivateObject

func (store *BoltStorage) ActivateObject(orgID string, objectType string, objectID string) common.SyncServiceError

ActivateObject marks object as active

func (*BoltStorage) AddObjectDestinations added in v1.6.5

func (store *BoltStorage) AddObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string, []common.StoreDestinationStatus, common.SyncServiceError)

AddObjectdestinations adds the destinations to object's destination list Returns the metadata, object's status, an array of added destinations after removing the overlapped destinations

func (*BoltStorage) AddUsersToACL

func (store *BoltStorage) AddUsersToACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

AddUsersToACL adds users to an ACL

func (*BoltStorage) AddWebhook

func (store *BoltStorage) AddWebhook(orgID string, objectType string, url string) common.SyncServiceError

AddWebhook stores a webhook for an object type

func (*BoltStorage) AppendObjectData

func (store *BoltStorage) AppendObjectData(orgID string, objectType string, objectID string, dataReader io.Reader, dataLength uint32,
	offset int64, total int64, isFirstChunk bool, isLastChunk bool, isTempData bool) (bool, common.SyncServiceError)

AppendObjectData appends a chunk of data to the object's data

func (*BoltStorage) CleanObjects

func (store *BoltStorage) CleanObjects() common.SyncServiceError

CleanObjects removes the objects received from the other side. For persistant storage only partially recieved objects are removed.

func (*BoltStorage) Cleanup

func (store *BoltStorage) Cleanup(isTest bool) common.SyncServiceError

Cleanup erase the on disk Bolt database only for ESS and test

func (*BoltStorage) CloseDataReader

func (store *BoltStorage) CloseDataReader(dataReader io.Reader) common.SyncServiceError

CloseDataReader closes the data reader if necessary

func (*BoltStorage) DecrementAndReturnRemainingConsumers

func (store *BoltStorage) DecrementAndReturnRemainingConsumers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingConsumers decrements the number of remaining consumers of the object

func (*BoltStorage) DecrementAndReturnRemainingReceivers

func (store *BoltStorage) DecrementAndReturnRemainingReceivers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingReceivers decrements the number of remaining receivers of the object

func (*BoltStorage) DeleteDestination

func (store *BoltStorage) DeleteDestination(orgID string, destType string, destID string) common.SyncServiceError

DeleteDestination deletes a destination

func (*BoltStorage) DeleteNotificationRecords

func (store *BoltStorage) DeleteNotificationRecords(orgID string, objectType string, objectID string,
	destType string, destID string) common.SyncServiceError

DeleteNotificationRecords deletes notification records to an object

func (*BoltStorage) DeleteObjectDestinations added in v1.6.5

func (store *BoltStorage) DeleteObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string, []common.StoreDestinationStatus, common.SyncServiceError)

DeleteObjectdestinations deletes the destinations from object's destination list Returns the metadata, objects' status, an array of destinations that removed from the current destination list

func (*BoltStorage) DeleteOrgToMessagingGroup

func (store *BoltStorage) DeleteOrgToMessagingGroup(orgID string) common.SyncServiceError

DeleteOrgToMessagingGroup deletes organization from messaging groups table

func (*BoltStorage) DeleteOrganization

func (store *BoltStorage) DeleteOrganization(orgID string) common.SyncServiceError

DeleteOrganization cleans up the storage from all the records associated with the organization

func (*BoltStorage) DeleteOrganizationInfo

func (store *BoltStorage) DeleteOrganizationInfo(orgID string) common.SyncServiceError

DeleteOrganizationInfo deletes organization information

func (*BoltStorage) DeleteStoredData

func (store *BoltStorage) DeleteStoredData(orgID string, objectType string, objectID string, isTempData bool) common.SyncServiceError

DeleteStoredData deletes the object's data

func (*BoltStorage) DeleteStoredObject

func (store *BoltStorage) DeleteStoredObject(orgID string, objectType string, objectID string) common.SyncServiceError

DeleteStoredObject deletes the object

func (*BoltStorage) DeleteWebhook

func (store *BoltStorage) DeleteWebhook(orgID string, objectType string, url string) common.SyncServiceError

DeleteWebhook deletes a webhook for an object type

func (*BoltStorage) DestinationExists

func (store *BoltStorage) DestinationExists(orgID string, destType string, destID string) (bool, common.SyncServiceError)

DestinationExists returns true if the destination exists, and false otherwise

func (*BoltStorage) GetNumberOfDestinations

func (store *BoltStorage) GetNumberOfDestinations() (uint32, common.SyncServiceError)

GetNumberOfDestinations returns the number of currently registered ESS nodes (for CSS)

func (*BoltStorage) GetNumberOfStoredObjects

func (store *BoltStorage) GetNumberOfStoredObjects() (uint32, common.SyncServiceError)

GetNumberOfStoredObjects returns the number of objects received from the application that are currently stored in this node's storage

func (*BoltStorage) GetObjectDestinations

func (store *BoltStorage) GetObjectDestinations(metaData common.MetaData) ([]common.Destination, common.SyncServiceError)

GetObjectDestinations gets destinations that the object has to be sent to

func (*BoltStorage) GetObjectDestinationsList

func (store *BoltStorage) GetObjectDestinationsList(orgID string, objectType string,
	objectID string) ([]common.StoreDestinationStatus, common.SyncServiceError)

GetObjectDestinationsList gets destinations that the object has to be sent to and their status

func (*BoltStorage) GetObjectsForDestination

func (store *BoltStorage) GetObjectsForDestination(orgID string, destType string, destID string) ([]common.ObjectStatus, common.SyncServiceError)

GetObjectsForDestination retrieves objects that are in use on a given node

func (*BoltStorage) GetObjectsToActivate

func (store *BoltStorage) GetObjectsToActivate() ([]common.MetaData, common.SyncServiceError)

GetObjectsToActivate returns inactive objects that are ready to be activated

func (*BoltStorage) HandleObjectInfoForLastDataChunk added in v1.6.8

func (store *BoltStorage) HandleObjectInfoForLastDataChunk(orgID string, objectType string, objectID string, isTempData bool, dataSize int64) (bool, common.SyncServiceError)

Handles the last data chunk when no data verification needed

func (*BoltStorage) Init

func (store *BoltStorage) Init() common.SyncServiceError

Init initializes the Bolt store

func (*BoltStorage) InsertInitialLeader

func (store *BoltStorage) InsertInitialLeader(leaderID string) (bool, common.SyncServiceError)

InsertInitialLeader inserts the initial leader entry

func (*BoltStorage) IsConnected

func (store *BoltStorage) IsConnected() bool

IsConnected returns false if the storage cannont be reached, and true otherwise

func (*BoltStorage) IsPersistent

func (store *BoltStorage) IsPersistent() bool

IsPersistent returns true if the storage is persistent, and false otherwise

func (*BoltStorage) LeaderPeriodicUpdate

func (store *BoltStorage) LeaderPeriodicUpdate(leaderID string) (bool, common.SyncServiceError)

LeaderPeriodicUpdate does the periodic update of the leader entry by the leader

func (*BoltStorage) MarkDestinationPolicyReceived

func (store *BoltStorage) MarkDestinationPolicyReceived(orgID string, objectType string, objectID string) common.SyncServiceError

MarkDestinationPolicyReceived marks an object's destination policy as having been received

func (*BoltStorage) MarkObjectDeleted

func (store *BoltStorage) MarkObjectDeleted(orgID string, objectType string, objectID string) common.SyncServiceError

MarkObjectDeleted marks the object as deleted

func (*BoltStorage) PerformMaintenance

func (store *BoltStorage) PerformMaintenance()

PerformMaintenance performs store's maintenance

func (*BoltStorage) ReadObjectData

func (store *BoltStorage) ReadObjectData(orgID string, objectType string, objectID string, size int, offset int64) (data []byte,
	eof bool, length int, err common.SyncServiceError)

ReadObjectData returns the object data with the specified parameters

func (*BoltStorage) RemoveInactiveDestinations

func (store *BoltStorage) RemoveInactiveDestinations(lastTimestamp time.Time)

RemoveInactiveDestinations removes destinations that haven't sent ping since the provided timestamp

func (*BoltStorage) RemoveObjectTempData added in v1.6.2

func (store *BoltStorage) RemoveObjectTempData(orgID string, objectType string, objectID string) common.SyncServiceError

func (*BoltStorage) RemoveUsersFromACL

func (store *BoltStorage) RemoveUsersFromACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

RemoveUsersFromACL removes users from an ACL

func (*BoltStorage) ResetObjectRemainingConsumers

func (store *BoltStorage) ResetObjectRemainingConsumers(orgID string, objectType string, objectID string) common.SyncServiceError

ResetObjectRemainingConsumers sets the remaining consumers count to the original ExpectedConsumers value

func (*BoltStorage) ResignLeadership

func (store *BoltStorage) ResignLeadership(leaderID string) common.SyncServiceError

ResignLeadership causes this sync service to give up the Leadership

func (*BoltStorage) RetrieveACL

func (store *BoltStorage) RetrieveACL(aclType string, orgID string, key string, aclUserType string) ([]common.ACLentry, common.SyncServiceError)

RetrieveACL retrieves the list of usernames on an ACL

func (*BoltStorage) RetrieveACLsInOrg

func (store *BoltStorage) RetrieveACLsInOrg(aclType string, orgID string) ([]string, common.SyncServiceError)

RetrieveACLsInOrg retrieves the list of ACLs in an organization

func (*BoltStorage) RetrieveAllObjects

func (store *BoltStorage) RetrieveAllObjects(orgID string, objectType string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveAllObjects returns the list of all the objects of the specified type

func (*BoltStorage) RetrieveAllObjectsAndUpdateDestinationListForDestination

func (store *BoltStorage) RetrieveAllObjectsAndUpdateDestinationListForDestination(destOrgID string, destType string, destID string) ([]common.MetaData, common.SyncServiceError)

RetrieveAllObjectsAndUpdateDestinationListForDestination retrieves objects that are in use on a given node and returns the list of metadata

func (*BoltStorage) RetrieveConsumedObjects

func (store *BoltStorage) RetrieveConsumedObjects() ([]common.ConsumedObject, common.SyncServiceError)

RetrieveConsumedObjects returns all the consumed objects originated from this node

func (*BoltStorage) RetrieveDestination

func (store *BoltStorage) RetrieveDestination(orgID string, destType string, destID string) (*common.Destination, common.SyncServiceError)

RetrieveDestination retrieves a destination

func (*BoltStorage) RetrieveDestinationProtocol

func (store *BoltStorage) RetrieveDestinationProtocol(orgID string, destType string, destID string) (string, common.SyncServiceError)

RetrieveDestinationProtocol retrieves communication protocol for the destination

func (*BoltStorage) RetrieveDestinations

func (store *BoltStorage) RetrieveDestinations(orgID string, destType string) ([]common.Destination, common.SyncServiceError)

RetrieveDestinations returns all the destinations with the provided orgID and destType

func (*BoltStorage) RetrieveLeader

func (store *BoltStorage) RetrieveLeader() (string, int32, time.Time, int64, common.SyncServiceError)

RetrieveLeader retrieves the Heartbeat timeout and Last heartbeat time stamp from the leader document

func (*BoltStorage) RetrieveMessagingGroup

func (store *BoltStorage) RetrieveMessagingGroup(orgID string) (string, common.SyncServiceError)

RetrieveMessagingGroup retrieves messaging group for organization

func (*BoltStorage) RetrieveNotificationRecord

func (store *BoltStorage) RetrieveNotificationRecord(orgID string, objectType string, objectID string, destType string,
	destID string) (*common.Notification, common.SyncServiceError)

RetrieveNotificationRecord retrieves notification

func (*BoltStorage) RetrieveNotifications

func (store *BoltStorage) RetrieveNotifications(orgID string, destType string, destID string, retrieveReceived bool) ([]common.Notification, common.SyncServiceError)

RetrieveNotifications returns the list of all the notifications that need to be resent to the destination

func (*BoltStorage) RetrieveObjOrDestTypeForGivenACLUser added in v0.10.12

func (store *BoltStorage) RetrieveObjOrDestTypeForGivenACLUser(aclType string, orgID string, aclUserType string, aclUsername string, aclRole string) ([]string, common.SyncServiceError)

RetrieveObjOrDestTypeForGivenACLUser retrieves object types that given acl user has access to

func (*BoltStorage) RetrieveObject

func (store *BoltStorage) RetrieveObject(orgID string, objectType string, objectID string) (*common.MetaData, common.SyncServiceError)

RetrieveObject returns the object meta data with the specified parameters

func (*BoltStorage) RetrieveObjectAndRemovedDestinationPolicyServices

func (store *BoltStorage) RetrieveObjectAndRemovedDestinationPolicyServices(orgID string, objectType string, objectID string) (*common.MetaData, []common.ServiceID, common.SyncServiceError)

RetrieveObjectAndRemovedDestinationPolicyServices returns the object metadata and removedDestinationPolicyServices with the specified param, only for ESS

func (*BoltStorage) RetrieveObjectAndStatus

func (store *BoltStorage) RetrieveObjectAndStatus(orgID string, objectType string, objectID string) (*common.MetaData, string, common.SyncServiceError)

RetrieveObjectAndStatus returns the object meta data and status with the specified parameters

func (*BoltStorage) RetrieveObjectData

func (store *BoltStorage) RetrieveObjectData(orgID string, objectType string, objectID string, isTempData bool) (io.Reader, common.SyncServiceError)

RetrieveObjectData returns the object data with the specified parameters

func (*BoltStorage) RetrieveObjectRemainingConsumers

func (store *BoltStorage) RetrieveObjectRemainingConsumers(orgID string, objectType string, objectID string) (int, common.SyncServiceError)

RetrieveObjectRemainingConsumers finds the object and returns the number of remaining consumers that haven't consumed the object yet

func (*BoltStorage) RetrieveObjectStatus

func (store *BoltStorage) RetrieveObjectStatus(orgID string, objectType string, objectID string) (string, common.SyncServiceError)

RetrieveObjectStatus finds the object and returns its status

func (*BoltStorage) RetrieveObjectTempData added in v1.6.8

func (store *BoltStorage) RetrieveObjectTempData(orgID string, objectType string, objectID string) (io.Reader, common.SyncServiceError)

func (*BoltStorage) RetrieveObjects

func (store *BoltStorage) RetrieveObjects(orgID string, destType string, destID string, resend int) ([]common.MetaData, common.SyncServiceError)

RetrieveObjects returns the list of all the objects that need to be sent to the destination For CSS: adds the new destination to the destinations lists of the relevant objects.

func (*BoltStorage) RetrieveObjectsWithDestinationPolicy

func (store *BoltStorage) RetrieveObjectsWithDestinationPolicy(orgID string, received bool) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicy returns the list of all the objects that have a Destination Policy If received is true, return objects marked as policy received

func (*BoltStorage) RetrieveObjectsWithDestinationPolicyByService

func (store *BoltStorage) RetrieveObjectsWithDestinationPolicyByService(orgID, serviceOrgID, serviceName string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyByService returns the list of all the object Policies for a particular service

func (*BoltStorage) RetrieveObjectsWithDestinationPolicyUpdatedSince

func (store *BoltStorage) RetrieveObjectsWithDestinationPolicyUpdatedSince(orgID string, since int64) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyUpdatedSince returns the list of all the objects that have a Destination Policy updated since the specified time

func (*BoltStorage) RetrieveObjectsWithFilters

func (store *BoltStorage) RetrieveObjectsWithFilters(orgID string, destinationPolicy *bool, dpServiceOrgID string, dpServiceName string, dpPropertyName string, since int64, objectType string, objectID string, destinationType string, destinationID string, noData *bool, expirationTimeBefore string, deleted *bool) ([]common.MetaData, common.SyncServiceError)

RetrieveObjectsWithFilters returns the list of all othe objects that meet the given conditions

func (*BoltStorage) RetrieveOrganizationInfo

func (store *BoltStorage) RetrieveOrganizationInfo(orgID string) (*common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizationInfo retrieves organization information

func (*BoltStorage) RetrieveOrganizations

func (store *BoltStorage) RetrieveOrganizations() ([]common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizations retrieves stored organizations' info

func (*BoltStorage) RetrievePendingNotifications

func (store *BoltStorage) RetrievePendingNotifications(orgID string, destType string, destID string) ([]common.Notification, common.SyncServiceError)

RetrievePendingNotifications returns the list of pending notifications that are waiting to be sent to the destination

func (*BoltStorage) RetrieveTimeOnServer

func (store *BoltStorage) RetrieveTimeOnServer() (time.Time, error)

RetrieveTimeOnServer retrieves the current time on the database server

func (*BoltStorage) RetrieveUpdatedMessagingGroups

func (store *BoltStorage) RetrieveUpdatedMessagingGroups(time time.Time) ([]common.MessagingGroup, common.SyncServiceError)

RetrieveUpdatedMessagingGroups retrieves messaging groups that were updated after the specified time

func (*BoltStorage) RetrieveUpdatedObjects

func (store *BoltStorage) RetrieveUpdatedObjects(orgID string, objectType string, received bool) ([]common.MetaData, common.SyncServiceError)

RetrieveUpdatedObjects returns the list of all the edge updated objects that are not marked as consumed If received is true, return objects marked as received

func (*BoltStorage) RetrieveUpdatedOrganizations

func (store *BoltStorage) RetrieveUpdatedOrganizations(time time.Time) ([]common.StoredOrganization, common.SyncServiceError)

RetrieveUpdatedOrganizations retrieves organizations that were updated after the specified time

func (*BoltStorage) RetrieveWebhooks

func (store *BoltStorage) RetrieveWebhooks(orgID string, objectType string) ([]string, common.SyncServiceError)

RetrieveWebhooks gets the webhooks for the object type

func (*BoltStorage) Stop

func (store *BoltStorage) Stop()

Stop stops the Bolt store

func (*BoltStorage) StoreDestination

func (store *BoltStorage) StoreDestination(destination common.Destination) common.SyncServiceError

StoreDestination stores a destination

func (*BoltStorage) StoreObject

func (store *BoltStorage) StoreObject(metaData common.MetaData, data []byte, status string) ([]common.StoreDestinationStatus, common.SyncServiceError)

StoreObject stores an object If the object already exists, return the changes in its destinations list (for CSS) - return the list of deleted destinations

func (*BoltStorage) StoreObjectData

func (store *BoltStorage) StoreObjectData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

StoreObjectData stores an object's data Return true if the object was found and updated Return false and no error, if the object doesn't exist

func (*BoltStorage) StoreObjectTempData added in v1.6.2

func (store *BoltStorage) StoreObjectTempData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

func (*BoltStorage) StoreOrgToMessagingGroup

func (store *BoltStorage) StoreOrgToMessagingGroup(orgID string, messagingGroup string) common.SyncServiceError

StoreOrgToMessagingGroup inserts organization to messaging groups table

func (*BoltStorage) StoreOrganization

func (store *BoltStorage) StoreOrganization(org common.Organization) (time.Time, common.SyncServiceError)

StoreOrganization stores organization information Returns the stored record timestamp for multiple CSS updates

func (*BoltStorage) UpdateDestinationLastPingTime

func (store *BoltStorage) UpdateDestinationLastPingTime(destination common.Destination) common.SyncServiceError

UpdateDestinationLastPingTime updates the last ping time for the destination

func (*BoltStorage) UpdateLeader

func (store *BoltStorage) UpdateLeader(leaderID string, version int64) (bool, common.SyncServiceError)

UpdateLeader updates the leader entry for a leadership takeover

func (*BoltStorage) UpdateNotificationRecord

func (store *BoltStorage) UpdateNotificationRecord(notification common.Notification) common.SyncServiceError

UpdateNotificationRecord updates/adds a notification record to the object

func (*BoltStorage) UpdateNotificationResendTime

func (store *BoltStorage) UpdateNotificationResendTime(notification common.Notification) common.SyncServiceError

UpdateNotificationResendTime sets the resend time of the notification to common.Configuration.ResendInterval*6

func (*BoltStorage) UpdateObjectDelivering

func (store *BoltStorage) UpdateObjectDelivering(orgID string, objectType string, objectID string) common.SyncServiceError

UpdateObjectDelivering marks the object as being delivered to all its destinations

func (*BoltStorage) UpdateObjectDeliveryStatus

func (store *BoltStorage) UpdateObjectDeliveryStatus(status string, message string, orgID string, objectType string, objectID string,
	destType string, destID string) (bool, common.SyncServiceError)

UpdateObjectDeliveryStatus changes the object's delivery status for the destination Returns true if the status is Deleted and all the destinations are in status Deleted

func (*BoltStorage) UpdateObjectDestinations

func (store *BoltStorage) UpdateObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, []common.StoreDestinationStatus, common.SyncServiceError)

UpdateObjectDestinations updates object's destinations Returns the meta data, object's status, an array of deleted destinations, and an array of added destinations

func (*BoltStorage) UpdateObjectSourceDataURI

func (store *BoltStorage) UpdateObjectSourceDataURI(orgID string, objectType string, objectID string, sourceDataURI string) common.SyncServiceError

UpdateObjectSourceDataURI pdates object's source data URI

func (*BoltStorage) UpdateObjectStatus

func (store *BoltStorage) UpdateObjectStatus(orgID string, objectType string, objectID string, status string) common.SyncServiceError

UpdateObjectStatus updates an object's status

func (*BoltStorage) UpdateRemovedDestinationPolicyServices

func (store *BoltStorage) UpdateRemovedDestinationPolicyServices(orgID string, objectType string, objectID string, destinationPolicyServices []common.ServiceID) common.SyncServiceError

UpdateRemovedDestinationPolicyServices update the removedDestinationPolicyServices, only for ESS

type Cache

type Cache struct {
	Store Storage
	// contains filtered or unexported fields
}

Cache is the caching store

func (*Cache) ActivateObject

func (store *Cache) ActivateObject(orgID string, objectType string, objectID string) common.SyncServiceError

ActivateObject marks object as active

func (*Cache) AddObjectDestinations added in v1.6.5

func (store *Cache) AddObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, common.SyncServiceError)

AddObjectdestinations adds the destinations to object's destination list Returns the metadata, object's status, an array of added destinations after removing the overlapped destinations

func (*Cache) AddUsersToACL

func (store *Cache) AddUsersToACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

AddUsersToACL adds users to an ACL

func (*Cache) AddWebhook

func (store *Cache) AddWebhook(orgID string, objectType string, url string) common.SyncServiceError

AddWebhook stores a webhook for an object type

func (*Cache) AppendObjectData

func (store *Cache) AppendObjectData(orgID string, objectType string, objectID string, dataReader io.Reader, dataLength uint32,
	offset int64, total int64, isFirstChunk bool, isLastChunk bool, isTempData bool) (bool, common.SyncServiceError)

AppendObjectData appends a chunk of data to the object's data

func (*Cache) CleanObjects

func (store *Cache) CleanObjects() common.SyncServiceError

CleanObjects removes the objects received from the other side. For persistant storage only partially recieved objects are removed.

func (*Cache) Cleanup

func (store *Cache) Cleanup(isTest bool) common.SyncServiceError

Cleanup erase the on disk Bolt database only for ESS and test

func (*Cache) CloseDataReader

func (store *Cache) CloseDataReader(dataReader io.Reader) common.SyncServiceError

CloseDataReader closes the data reader if necessary

func (*Cache) DecrementAndReturnRemainingConsumers

func (store *Cache) DecrementAndReturnRemainingConsumers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingConsumers decrements the number of remaining consumers of the object

func (*Cache) DecrementAndReturnRemainingReceivers

func (store *Cache) DecrementAndReturnRemainingReceivers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingReceivers decrements the number of remaining receivers of the object

func (*Cache) DeleteDestination

func (store *Cache) DeleteDestination(orgID string, destType string, destID string) common.SyncServiceError

DeleteDestination deletes the destination

func (*Cache) DeleteNotificationRecords

func (store *Cache) DeleteNotificationRecords(orgID string, objectType string, objectID string,
	destType string, destID string) common.SyncServiceError

DeleteNotificationRecords deletes notification records to an object

func (*Cache) DeleteObjectDestinations added in v1.6.5

func (store *Cache) DeleteObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, common.SyncServiceError)

DeleteObjectdestinations deletes the destinations from object's destination list Returns the metadata, objects' status, an array of destinations that removed from the current destination list

func (*Cache) DeleteOrgToMessagingGroup

func (store *Cache) DeleteOrgToMessagingGroup(orgID string) common.SyncServiceError

DeleteOrgToMessagingGroup deletes organization from messaging groups table

func (*Cache) DeleteOrganization

func (store *Cache) DeleteOrganization(orgID string) common.SyncServiceError

DeleteOrganization cleans up the storage from all the records associated with the organization

func (*Cache) DeleteOrganizationInfo

func (store *Cache) DeleteOrganizationInfo(orgID string) common.SyncServiceError

DeleteOrganizationInfo deletes organization information

func (*Cache) DeleteStoredData

func (store *Cache) DeleteStoredData(orgID string, objectType string, objectID string, isTempData bool) common.SyncServiceError

DeleteStoredData deletes the object's data

func (*Cache) DeleteStoredObject

func (store *Cache) DeleteStoredObject(orgID string, objectType string, objectID string) common.SyncServiceError

DeleteStoredObject deletes the object

func (*Cache) DeleteWebhook

func (store *Cache) DeleteWebhook(orgID string, objectType string, url string) common.SyncServiceError

DeleteWebhook deletes a webhook for an object type

func (*Cache) DestinationExists

func (store *Cache) DestinationExists(orgID string, destType string, destID string) (bool, common.SyncServiceError)

DestinationExists returns true if the destination exists, and false otherwise

func (*Cache) GetNumberOfDestinations

func (store *Cache) GetNumberOfDestinations() (uint32, common.SyncServiceError)

GetNumberOfDestinations returns the number of currently registered ESS nodes (for CSS)

func (*Cache) GetNumberOfStoredObjects

func (store *Cache) GetNumberOfStoredObjects() (uint32, common.SyncServiceError)

GetNumberOfStoredObjects returns the number of objects received from the application that are currently stored in this node's storage

func (*Cache) GetObjectDestinations

func (store *Cache) GetObjectDestinations(metaData common.MetaData) ([]common.Destination, common.SyncServiceError)

GetObjectDestinations gets destinations that the object has to be sent to

func (*Cache) GetObjectDestinationsList

func (store *Cache) GetObjectDestinationsList(orgID string, objectType string,
	objectID string) ([]common.StoreDestinationStatus, common.SyncServiceError)

GetObjectDestinationsList gets destinations that the object has to be sent to and their status

func (*Cache) GetObjectsForDestination

func (store *Cache) GetObjectsForDestination(orgID string, destType string, destID string) ([]common.ObjectStatus, common.SyncServiceError)

GetObjectsForDestination retrieves objects that are in use on a given node

func (*Cache) GetObjectsToActivate

func (store *Cache) GetObjectsToActivate() ([]common.MetaData, common.SyncServiceError)

GetObjectsToActivate returns inactive objects that are ready to be activated

func (*Cache) HandleObjectInfoForLastDataChunk added in v1.6.8

func (store *Cache) HandleObjectInfoForLastDataChunk(orgID string, objectType string, objectID string, isTempData bool, dataSize int64) (bool, common.SyncServiceError)

func (*Cache) Init

func (store *Cache) Init() common.SyncServiceError

Init initializes the Cache store

func (*Cache) InsertInitialLeader

func (store *Cache) InsertInitialLeader(leaderID string) (bool, common.SyncServiceError)

InsertInitialLeader inserts the initial leader entry

func (*Cache) IsConnected

func (store *Cache) IsConnected() bool

IsConnected returns false if the storage cannont be reached, and true otherwise

func (*Cache) IsPersistent

func (store *Cache) IsPersistent() bool

IsPersistent returns true if the storage is persistent, and false otherwise

func (*Cache) LeaderPeriodicUpdate

func (store *Cache) LeaderPeriodicUpdate(leaderID string) (bool, common.SyncServiceError)

LeaderPeriodicUpdate does the periodic update of the leader entry by the leader

func (*Cache) MarkDestinationPolicyReceived

func (store *Cache) MarkDestinationPolicyReceived(orgID string, objectType string, objectID string) common.SyncServiceError

MarkDestinationPolicyReceived marks an object's destination policy as having been received

func (*Cache) MarkObjectDeleted

func (store *Cache) MarkObjectDeleted(orgID string, objectType string, objectID string) common.SyncServiceError

MarkObjectDeleted marks the object as deleted

func (*Cache) PerformMaintenance

func (store *Cache) PerformMaintenance()

PerformMaintenance performs store's maintenance

func (*Cache) ReadObjectData

func (store *Cache) ReadObjectData(orgID string, objectType string, objectID string, size int, offset int64) ([]byte, bool, int, common.SyncServiceError)

ReadObjectData returns the object data with the specified parameters

func (*Cache) RemoveInactiveDestinations

func (store *Cache) RemoveInactiveDestinations(lastTimestamp time.Time)

RemoveInactiveDestinations removes destinations that haven't sent ping since the provided timestamp

func (*Cache) RemoveObjectTempData added in v1.6.2

func (store *Cache) RemoveObjectTempData(orgID string, objectType string, objectID string) common.SyncServiceError

func (*Cache) RemoveUsersFromACL

func (store *Cache) RemoveUsersFromACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

RemoveUsersFromACL removes users from an ACL

func (*Cache) ResetObjectRemainingConsumers

func (store *Cache) ResetObjectRemainingConsumers(orgID string, objectType string, objectID string) common.SyncServiceError

ResetObjectRemainingConsumers sets the remaining consumers count to the original ExpectedConsumers value

func (*Cache) ResignLeadership

func (store *Cache) ResignLeadership(leaderID string) common.SyncServiceError

ResignLeadership causes this sync service to give up the Leadership

func (*Cache) RetrieveACL

func (store *Cache) RetrieveACL(aclType string, orgID string, key string, aclUserType string) ([]common.ACLentry, common.SyncServiceError)

RetrieveACL retrieves the list of usernames on an ACL

func (*Cache) RetrieveACLsInOrg

func (store *Cache) RetrieveACLsInOrg(aclType string, orgID string) ([]string, common.SyncServiceError)

RetrieveACLsInOrg retrieves the list of ACLs in an organization

func (*Cache) RetrieveAllObjects

func (store *Cache) RetrieveAllObjects(orgID string, objectType string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveAllObjects returns the list of all the objects of the specified type

func (*Cache) RetrieveAllObjectsAndUpdateDestinationListForDestination

func (store *Cache) RetrieveAllObjectsAndUpdateDestinationListForDestination(orgID string, destType string, destID string) ([]common.MetaData, common.SyncServiceError)

RetrieveAllObjectsAndUpdateDestinationListForDestination retrieves objects that are in use on a given node and returns the list of metadata

func (*Cache) RetrieveConsumedObjects

func (store *Cache) RetrieveConsumedObjects() ([]common.ConsumedObject, common.SyncServiceError)

RetrieveConsumedObjects returns all the consumed objects originated from this node

func (*Cache) RetrieveDestination

func (store *Cache) RetrieveDestination(orgID string, destType string, destID string) (*common.Destination, common.SyncServiceError)

RetrieveDestination retrieves a destination

func (*Cache) RetrieveDestinationProtocol

func (store *Cache) RetrieveDestinationProtocol(orgID string, destType string, destID string) (string, common.SyncServiceError)

RetrieveDestinationProtocol retrieves the communication protocol for the destination

func (*Cache) RetrieveDestinations

func (store *Cache) RetrieveDestinations(orgID string, destType string) ([]common.Destination, common.SyncServiceError)

RetrieveDestinations returns all the destinations with the provided orgID and destType

func (*Cache) RetrieveLeader

func (store *Cache) RetrieveLeader() (string, int32, time.Time, int64, common.SyncServiceError)

RetrieveLeader retrieves the Heartbeat timeout and Last heartbeat time stamp from the leader document

func (*Cache) RetrieveMessagingGroup

func (store *Cache) RetrieveMessagingGroup(orgID string) (string, common.SyncServiceError)

RetrieveMessagingGroup retrieves messaging group for organization

func (*Cache) RetrieveNotificationRecord

func (store *Cache) RetrieveNotificationRecord(orgID string, objectType string, objectID string, destType string,
	destID string) (*common.Notification, common.SyncServiceError)

RetrieveNotificationRecord retrieves notification

func (*Cache) RetrieveNotifications

func (store *Cache) RetrieveNotifications(orgID string, destType string, destID string, retrieveReceived bool) ([]common.Notification, common.SyncServiceError)

RetrieveNotifications returns the list of all the notifications that need to be resent to the destination

func (*Cache) RetrieveObjOrDestTypeForGivenACLUser added in v0.10.12

func (store *Cache) RetrieveObjOrDestTypeForGivenACLUser(aclType string, orgID string, aclUserType string, aclUsername string, aclRole string) ([]string, common.SyncServiceError)

RetrieveObjOrDestTypeForGivenACLUser retrieves object types that given acl user has access to

func (*Cache) RetrieveObject

func (store *Cache) RetrieveObject(orgID string, objectType string, objectID string) (*common.MetaData, common.SyncServiceError)

RetrieveObject returns the object meta data with the specified parameters

func (*Cache) RetrieveObjectAndRemovedDestinationPolicyServices

func (store *Cache) RetrieveObjectAndRemovedDestinationPolicyServices(orgID string, objectType string, objectID string) (*common.MetaData, []common.ServiceID, common.SyncServiceError)

RetrieveObjectAndRemovedDestinationPolicyServices returns the object metadata and removedDestinationPolicyServices with the specified param, only for ESS

func (*Cache) RetrieveObjectAndStatus

func (store *Cache) RetrieveObjectAndStatus(orgID string, objectType string, objectID string) (*common.MetaData, string, common.SyncServiceError)

RetrieveObjectAndStatus returns the object meta data and status with the specified parameters

func (*Cache) RetrieveObjectData

func (store *Cache) RetrieveObjectData(orgID string, objectType string, objectID string, isTempData bool) (io.Reader, common.SyncServiceError)

RetrieveObjectData returns the object data with the specified parameters

func (*Cache) RetrieveObjectRemainingConsumers

func (store *Cache) RetrieveObjectRemainingConsumers(orgID string, objectType string, objectID string) (int, common.SyncServiceError)

RetrieveObjectRemainingConsumers finds the object and returns the number of remaining consumers that haven't consumed the object yet

func (*Cache) RetrieveObjectStatus

func (store *Cache) RetrieveObjectStatus(orgID string, objectType string, objectID string) (string, common.SyncServiceError)

RetrieveObjectStatus finds the object and return its status

func (*Cache) RetrieveObjectTempData added in v1.6.8

func (store *Cache) RetrieveObjectTempData(orgID string, objectType string, objectID string) (io.Reader, common.SyncServiceError)

func (*Cache) RetrieveObjects

func (store *Cache) RetrieveObjects(orgID string, destType string, destID string, resend int) ([]common.MetaData, common.SyncServiceError)

RetrieveObjects returns the list of all the objects that need to be sent to the destination

func (*Cache) RetrieveObjectsWithDestinationPolicy

func (store *Cache) RetrieveObjectsWithDestinationPolicy(orgID string, received bool) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicy returns the list of all the objects that have a Destination Policy If received is true, return objects marked as policy received

func (*Cache) RetrieveObjectsWithDestinationPolicyByService

func (store *Cache) RetrieveObjectsWithDestinationPolicyByService(orgID, serviceOrgID, serviceName string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyByService returns the list of all the object Policies for a particular service

func (*Cache) RetrieveObjectsWithDestinationPolicyUpdatedSince

func (store *Cache) RetrieveObjectsWithDestinationPolicyUpdatedSince(orgID string, since int64) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyUpdatedSince returns the list of all the objects that have a Destination Policy updated since the specified time

func (*Cache) RetrieveObjectsWithFilters

func (store *Cache) RetrieveObjectsWithFilters(orgID string, destinationPolicy *bool, dpServiceOrgID string, dpServiceName string, dpPropertyName string, since int64, objectType string, objectID string, destinationType string, destinationID string, noData *bool, expirationTimeBefore string, deleted *bool) ([]common.MetaData, common.SyncServiceError)

RetrieveObjectsWithFilters returns the list of all othe objects that meet the given conditions

func (*Cache) RetrieveOrganizationInfo

func (store *Cache) RetrieveOrganizationInfo(orgID string) (*common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizationInfo retrieves organization information

func (*Cache) RetrieveOrganizations

func (store *Cache) RetrieveOrganizations() ([]common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizations retrieves stored organizations' info

func (*Cache) RetrievePendingNotifications

func (store *Cache) RetrievePendingNotifications(orgID string, destType string, destID string) ([]common.Notification, common.SyncServiceError)

RetrievePendingNotifications returns the list of pending notifications that are waiting to be sent to the destination

func (*Cache) RetrieveTimeOnServer

func (store *Cache) RetrieveTimeOnServer() (time.Time, error)

RetrieveTimeOnServer retrieves the current time on the database server

func (*Cache) RetrieveUpdatedMessagingGroups

func (store *Cache) RetrieveUpdatedMessagingGroups(time time.Time) ([]common.MessagingGroup, common.SyncServiceError)

RetrieveUpdatedMessagingGroups retrieves messaging groups that were updated after the specified time

func (*Cache) RetrieveUpdatedObjects

func (store *Cache) RetrieveUpdatedObjects(orgID string, objectType string, received bool) ([]common.MetaData, common.SyncServiceError)

RetrieveUpdatedObjects returns the list of all the edge updated objects that are not marked as consumed or received If received is true, return objects marked as received

func (*Cache) RetrieveUpdatedOrganizations

func (store *Cache) RetrieveUpdatedOrganizations(time time.Time) ([]common.StoredOrganization, common.SyncServiceError)

RetrieveUpdatedOrganizations retrieves organizations that were updated after the specified time

func (*Cache) RetrieveWebhooks

func (store *Cache) RetrieveWebhooks(orgID string, objectType string) ([]string, common.SyncServiceError)

RetrieveWebhooks gets the webhooks for the object type

func (*Cache) Stop

func (store *Cache) Stop()

Stop stops the Cache store

func (*Cache) StoreDestination

func (store *Cache) StoreDestination(dest common.Destination) common.SyncServiceError

StoreDestination stores the destination

func (*Cache) StoreObject

func (store *Cache) StoreObject(metaData common.MetaData, data []byte, status string) ([]common.StoreDestinationStatus, common.SyncServiceError)

StoreObject stores an object

func (*Cache) StoreObjectData

func (store *Cache) StoreObjectData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

StoreObjectData stores an object's data Return true if the object was found and updated Return false and no error, if the object doesn't exist

func (*Cache) StoreObjectTempData added in v1.6.2

func (store *Cache) StoreObjectTempData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

func (*Cache) StoreOrgToMessagingGroup

func (store *Cache) StoreOrgToMessagingGroup(orgID string, messagingGroup string) common.SyncServiceError

StoreOrgToMessagingGroup inserts organization to messaging groups table

func (*Cache) StoreOrganization

func (store *Cache) StoreOrganization(org common.Organization) (time.Time, common.SyncServiceError)

StoreOrganization stores organization information Returns the stored record timestamp for multiple CSS updates

func (*Cache) UpdateDestinationLastPingTime

func (store *Cache) UpdateDestinationLastPingTime(destination common.Destination) common.SyncServiceError

UpdateDestinationLastPingTime updates the last ping time for the destination

func (*Cache) UpdateLeader

func (store *Cache) UpdateLeader(leaderID string, version int64) (bool, common.SyncServiceError)

UpdateLeader updates the leader entry for a leadership takeover

func (*Cache) UpdateNotificationRecord

func (store *Cache) UpdateNotificationRecord(notification common.Notification) common.SyncServiceError

UpdateNotificationRecord updates/adds a notification record to the object

func (*Cache) UpdateNotificationResendTime

func (store *Cache) UpdateNotificationResendTime(notification common.Notification) common.SyncServiceError

UpdateNotificationResendTime sets the resend time of the notification to common.Configuration.ResendInterval*6

func (*Cache) UpdateObjectDelivering

func (store *Cache) UpdateObjectDelivering(orgID string, objectType string, objectID string) common.SyncServiceError

UpdateObjectDelivering marks the object as being delivered to all its destinations

func (*Cache) UpdateObjectDeliveryStatus

func (store *Cache) UpdateObjectDeliveryStatus(status string, message string, orgID string, objectType string, objectID string,
	destType string, destID string) (bool, common.SyncServiceError)

UpdateObjectDeliveryStatus changes the object's delivery status for the destination Returns true if the status is Deleted and all the destinations are in status Deleted

func (*Cache) UpdateObjectDestinations

func (store *Cache) UpdateObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, []common.StoreDestinationStatus, common.SyncServiceError)

UpdateObjectDestinations updates object's destinations Returns the meta data, object's status, an array of deleted destinations, and an array of added destinations

func (*Cache) UpdateObjectSourceDataURI

func (store *Cache) UpdateObjectSourceDataURI(orgID string, objectType string, objectID string, sourceDataURI string) common.SyncServiceError

UpdateObjectSourceDataURI pdates object's source data URI

func (*Cache) UpdateObjectStatus

func (store *Cache) UpdateObjectStatus(orgID string, objectType string, objectID string, status string) common.SyncServiceError

UpdateObjectStatus updates an object's status

func (*Cache) UpdateRemovedDestinationPolicyServices

func (store *Cache) UpdateRemovedDestinationPolicyServices(orgID string, objectType string, objectID string, destinationPolicyServices []common.ServiceID) common.SyncServiceError

UpdateRemovedDestinationPolicyServices update the removedDestinationPolicyServices, only for ESS

type Discarded

type Discarded struct {
	// contains filtered or unexported fields
}

Discarded is the error returned if an out-of-order chunk wasn't appended to the stored object because of memory usage protection

func (*Discarded) Error

func (e *Discarded) Error() string

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is the error used in the storage layer

func (*Error) Error

func (e *Error) Error() string

type InMemoryStorage

type InMemoryStorage struct {
	// contains filtered or unexported fields
}

InMemoryStorage is an in-memory store

func (*InMemoryStorage) ActivateObject

func (store *InMemoryStorage) ActivateObject(orgID string, objectType string, objectID string) common.SyncServiceError

ActivateObject marks object as active

func (*InMemoryStorage) AddObjectDestinations added in v1.6.5

func (store *InMemoryStorage) AddObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, common.SyncServiceError)

AddObjectdestinations adds the destinations to object's destination list Returns the metadata, object's status, an array of added destinations after removing the overlapped destinations

func (*InMemoryStorage) AddUsersToACL

func (store *InMemoryStorage) AddUsersToACL(aclType string, orgID string, key string, usernames []common.ACLentry) common.SyncServiceError

AddUsersToACL adds users to an ACL

func (*InMemoryStorage) AddWebhook

func (store *InMemoryStorage) AddWebhook(orgID string, objectType string, url string) common.SyncServiceError

AddWebhook stores a webhook for an object type

func (*InMemoryStorage) AppendObjectData

func (store *InMemoryStorage) AppendObjectData(orgID string, objectType string, objectID string, dataReader io.Reader, dataLength uint32,
	offset int64, total int64, isFirstChunk bool, isLastChunk bool, isTempData bool) (bool, common.SyncServiceError)

AppendObjectData appends a chunk of data to the object's data

func (*InMemoryStorage) CleanObjects

func (store *InMemoryStorage) CleanObjects() common.SyncServiceError

CleanObjects removes the objects received from the other side. For persistant storage only partially recieved objects are removed.

func (*InMemoryStorage) Cleanup

func (store *InMemoryStorage) Cleanup(isTest bool) common.SyncServiceError

Cleanup erase the on disk Bolt database only for ESS and test

func (*InMemoryStorage) CloseDataReader

func (store *InMemoryStorage) CloseDataReader(dataReader io.Reader) common.SyncServiceError

CloseDataReader closes the data reader if necessary

func (*InMemoryStorage) DecrementAndReturnRemainingConsumers

func (store *InMemoryStorage) DecrementAndReturnRemainingConsumers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingConsumers decrements the number of remaining consumers of the object

func (*InMemoryStorage) DecrementAndReturnRemainingReceivers

func (store *InMemoryStorage) DecrementAndReturnRemainingReceivers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingReceivers decrements the number of remaining receivers of the object

func (*InMemoryStorage) DeleteDestination

func (store *InMemoryStorage) DeleteDestination(orgID string, destType string, destID string) common.SyncServiceError

DeleteDestination deletes a destination

func (*InMemoryStorage) DeleteNotificationRecords

func (store *InMemoryStorage) DeleteNotificationRecords(orgID string, objectType string, objectID string,
	destType string, destID string) common.SyncServiceError

DeleteNotificationRecords deletes notification records to an object

func (*InMemoryStorage) DeleteObjectDestinations added in v1.6.5

func (store *InMemoryStorage) DeleteObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, common.SyncServiceError)

DeleteObjectdestinations deletes the destinations from object's destination list Returns the metadata, objects' status, an array of destinations that removed from the current destination list

func (*InMemoryStorage) DeleteOrgToMessagingGroup

func (store *InMemoryStorage) DeleteOrgToMessagingGroup(orgID string) common.SyncServiceError

DeleteOrgToMessagingGroup deletes organization from messaging groups table

func (*InMemoryStorage) DeleteOrganization

func (store *InMemoryStorage) DeleteOrganization(orgID string) common.SyncServiceError

DeleteOrganization cleans up the storage from all the records associated with the organization

func (*InMemoryStorage) DeleteOrganizationInfo

func (store *InMemoryStorage) DeleteOrganizationInfo(orgID string) common.SyncServiceError

DeleteOrganizationInfo deletes organization information

func (*InMemoryStorage) DeleteStoredData

func (store *InMemoryStorage) DeleteStoredData(orgID string, objectType string, objectID string, isTempData bool) common.SyncServiceError

DeleteStoredData deletes the object's data

func (*InMemoryStorage) DeleteStoredObject

func (store *InMemoryStorage) DeleteStoredObject(orgID string, objectType string, objectID string) common.SyncServiceError

DeleteStoredObject deletes the object

func (*InMemoryStorage) DeleteWebhook

func (store *InMemoryStorage) DeleteWebhook(orgID string, objectType string, url string) common.SyncServiceError

DeleteWebhook deletes a webhook for an object type

func (*InMemoryStorage) DestinationExists

func (store *InMemoryStorage) DestinationExists(orgID string, destType string, destID string) (bool, common.SyncServiceError)

DestinationExists returns true if the destination exists, and false otherwise

func (*InMemoryStorage) GetNumberOfDestinations

func (store *InMemoryStorage) GetNumberOfDestinations() (uint32, common.SyncServiceError)

GetNumberOfDestinations returns the number of currently registered ESS nodes (for CSS)

func (*InMemoryStorage) GetNumberOfStoredObjects

func (store *InMemoryStorage) GetNumberOfStoredObjects() (uint32, common.SyncServiceError)

GetNumberOfStoredObjects returns the number of objects received from the application that are currently stored in this node's storage

func (*InMemoryStorage) GetObjectDestinations

func (store *InMemoryStorage) GetObjectDestinations(metaData common.MetaData) ([]common.Destination, common.SyncServiceError)

GetObjectDestinations gets destinations that the object has to be sent to

func (*InMemoryStorage) GetObjectDestinationsList

func (store *InMemoryStorage) GetObjectDestinationsList(orgID string, objectType string,
	objectID string) ([]common.StoreDestinationStatus, common.SyncServiceError)

GetObjectDestinationsList gets destinations that the object has to be sent to and their status

func (*InMemoryStorage) GetObjectsForDestination

func (store *InMemoryStorage) GetObjectsForDestination(orgID string, destType string, destID string) ([]common.ObjectStatus, common.SyncServiceError)

GetObjectsForDestination retrieves objects that are in use on a given node

func (*InMemoryStorage) GetObjectsToActivate

func (store *InMemoryStorage) GetObjectsToActivate() ([]common.MetaData, common.SyncServiceError)

GetObjectsToActivate returns inactive objects that are ready to be activated

func (*InMemoryStorage) HandleObjectInfoForLastDataChunk added in v1.6.8

func (store *InMemoryStorage) HandleObjectInfoForLastDataChunk(orgID string, objectType string, objectID string, isTempData bool, dataSize int64) (bool, common.SyncServiceError)

func (*InMemoryStorage) Init

func (store *InMemoryStorage) Init() common.SyncServiceError

Init initializes the InMemory store

func (*InMemoryStorage) InsertInitialLeader

func (store *InMemoryStorage) InsertInitialLeader(leaderID string) (bool, common.SyncServiceError)

InsertInitialLeader inserts the initial leader entry

func (*InMemoryStorage) IsConnected

func (store *InMemoryStorage) IsConnected() bool

IsConnected returns false if the storage cannont be reached, and true otherwise

func (*InMemoryStorage) IsPersistent

func (store *InMemoryStorage) IsPersistent() bool

IsPersistent returns true if the storage is persistent, and false otherwise

func (*InMemoryStorage) LeaderPeriodicUpdate

func (store *InMemoryStorage) LeaderPeriodicUpdate(leaderID string) (bool, common.SyncServiceError)

LeaderPeriodicUpdate does the periodic update of the leader entry by the leader

func (*InMemoryStorage) MarkDestinationPolicyReceived

func (store *InMemoryStorage) MarkDestinationPolicyReceived(orgID string, objectType string, objectID string) common.SyncServiceError

MarkDestinationPolicyReceived marks an object's destination policy as having been received

func (*InMemoryStorage) MarkObjectDeleted

func (store *InMemoryStorage) MarkObjectDeleted(orgID string, objectType string, objectID string) common.SyncServiceError

MarkObjectDeleted marks the object as deleted

func (*InMemoryStorage) PerformMaintenance

func (store *InMemoryStorage) PerformMaintenance()

PerformMaintenance performs store's maintenance

func (*InMemoryStorage) ReadObjectData

func (store *InMemoryStorage) ReadObjectData(orgID string, objectType string, objectID string, size int, offset int64) ([]byte, bool, int, common.SyncServiceError)

ReadObjectData returns the object data with the specified parameters

func (*InMemoryStorage) RemoveInactiveDestinations

func (store *InMemoryStorage) RemoveInactiveDestinations(lastTimestamp time.Time)

RemoveInactiveDestinations removes destinations that haven't sent ping since the provided timestamp

func (*InMemoryStorage) RemoveObjectTempData added in v1.6.2

func (store *InMemoryStorage) RemoveObjectTempData(orgID string, objectType string, objectID string) common.SyncServiceError

func (*InMemoryStorage) RemoveUsersFromACL

func (store *InMemoryStorage) RemoveUsersFromACL(aclType string, orgID string, key string, usernames []common.ACLentry) common.SyncServiceError

RemoveUsersFromACL removes users from an ACL

func (*InMemoryStorage) ResetObjectRemainingConsumers

func (store *InMemoryStorage) ResetObjectRemainingConsumers(orgID string, objectType string, objectID string) common.SyncServiceError

ResetObjectRemainingConsumers sets the remaining consumers count to the original ExpectedConsumers value

func (*InMemoryStorage) ResignLeadership

func (store *InMemoryStorage) ResignLeadership(leaderID string) common.SyncServiceError

ResignLeadership causes this sync service to give up the Leadership

func (*InMemoryStorage) RetrieveACL

func (store *InMemoryStorage) RetrieveACL(aclType string, orgID string, key string, aclUserType string) ([]common.ACLentry, common.SyncServiceError)

RetrieveACL retrieves the list of usernames on an ACL

func (*InMemoryStorage) RetrieveACLsInOrg

func (store *InMemoryStorage) RetrieveACLsInOrg(aclType string, orgID string) ([]string, common.SyncServiceError)

RetrieveACLsInOrg retrieves the list of ACLs in an organization

func (*InMemoryStorage) RetrieveAllObjects

func (store *InMemoryStorage) RetrieveAllObjects(orgID string, objectType string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveAllObjects returns the list of all the objects of the specified type

func (*InMemoryStorage) RetrieveAllObjectsAndUpdateDestinationListForDestination

func (store *InMemoryStorage) RetrieveAllObjectsAndUpdateDestinationListForDestination(orgID string, destType string, destID string) ([]common.MetaData, common.SyncServiceError)

RetrieveAllObjectsAndUpdateDestinationListForDestination retrieves objects that are in use on a given node and returns the list of metadata

func (*InMemoryStorage) RetrieveConsumedObjects

func (store *InMemoryStorage) RetrieveConsumedObjects() ([]common.ConsumedObject, common.SyncServiceError)

RetrieveConsumedObjects returns all the consumed objects originated from this node

func (*InMemoryStorage) RetrieveDestination

func (store *InMemoryStorage) RetrieveDestination(orgID string, destType string, destID string) (*common.Destination, common.SyncServiceError)

RetrieveDestination retrieves a destination

func (*InMemoryStorage) RetrieveDestinationProtocol

func (store *InMemoryStorage) RetrieveDestinationProtocol(orgID string, destType string, destID string) (string, common.SyncServiceError)

RetrieveDestinationProtocol retrieves communication protocol for the destination

func (*InMemoryStorage) RetrieveDestinations

func (store *InMemoryStorage) RetrieveDestinations(orgID string, destType string) ([]common.Destination, common.SyncServiceError)

RetrieveDestinations returns all the destinations with the provided orgID and destType

func (*InMemoryStorage) RetrieveLeader

func (store *InMemoryStorage) RetrieveLeader() (string, int32, time.Time, int64, common.SyncServiceError)

RetrieveLeader retrieves the Heartbeat timeout and Last heartbeat time stamp from the leader document

func (*InMemoryStorage) RetrieveMessagingGroup

func (store *InMemoryStorage) RetrieveMessagingGroup(orgID string) (string, common.SyncServiceError)

RetrieveMessagingGroup retrieves messaging group for organization

func (*InMemoryStorage) RetrieveNotificationRecord

func (store *InMemoryStorage) RetrieveNotificationRecord(orgID string, objectType string, objectID string, destType string,
	destID string) (*common.Notification, common.SyncServiceError)

RetrieveNotificationRecord retrieves notification

func (*InMemoryStorage) RetrieveNotifications

func (store *InMemoryStorage) RetrieveNotifications(orgID string, destType string, destID string, retrieveReceived bool) ([]common.Notification,
	common.SyncServiceError)

RetrieveNotifications returns the list of all the notifications that need to be resent to the destination

func (*InMemoryStorage) RetrieveObjOrDestTypeForGivenACLUser added in v0.10.12

func (store *InMemoryStorage) RetrieveObjOrDestTypeForGivenACLUser(aclType string, orgID string, aclUserType string, aclUsername string, aclRole string) ([]string, common.SyncServiceError)

RetrieveObjOrDestTypeForGivenACLUser retrieves object types that given acl user has access to

func (*InMemoryStorage) RetrieveObject

func (store *InMemoryStorage) RetrieveObject(orgID string, objectType string, objectID string) (*common.MetaData, common.SyncServiceError)

RetrieveObject returns the object meta data with the specified parameters

func (*InMemoryStorage) RetrieveObjectAndRemovedDestinationPolicyServices

func (store *InMemoryStorage) RetrieveObjectAndRemovedDestinationPolicyServices(orgID string, objectType string, objectID string) (*common.MetaData, []common.ServiceID, common.SyncServiceError)

RetrieveObjectAndRemovedDestinationPolicyServices returns the object metadata and removedDestinationPolicyServices with the specified param, only for ESS

func (*InMemoryStorage) RetrieveObjectAndStatus

func (store *InMemoryStorage) RetrieveObjectAndStatus(orgID string, objectType string, objectID string) (*common.MetaData, string, common.SyncServiceError)

RetrieveObjectAndStatus returns the object meta data and status with the specified parameters

func (*InMemoryStorage) RetrieveObjectData

func (store *InMemoryStorage) RetrieveObjectData(orgID string, objectType string, objectID string, isTempData bool) (io.Reader, common.SyncServiceError)

RetrieveObjectData returns the object data with the specified parameters

func (*InMemoryStorage) RetrieveObjectRemainingConsumers

func (store *InMemoryStorage) RetrieveObjectRemainingConsumers(orgID string, objectType string, objectID string) (int, common.SyncServiceError)

RetrieveObjectRemainingConsumers finds the object and returns the number of remaining consumers that haven't consumed the object yet

func (*InMemoryStorage) RetrieveObjectStatus

func (store *InMemoryStorage) RetrieveObjectStatus(orgID string, objectType string, objectID string) (string, common.SyncServiceError)

RetrieveObjectStatus finds the object and returns its status

func (*InMemoryStorage) RetrieveObjectTempData added in v1.6.8

func (store *InMemoryStorage) RetrieveObjectTempData(orgID string, objectType string, objectID string) (io.Reader, common.SyncServiceError)

func (*InMemoryStorage) RetrieveObjects

func (store *InMemoryStorage) RetrieveObjects(orgID string, destType string, destID string, resend int) ([]common.MetaData, common.SyncServiceError)

RetrieveObjects returns the list of all the objects that need to be sent to the destination

func (*InMemoryStorage) RetrieveObjectsWithDestinationPolicy

func (store *InMemoryStorage) RetrieveObjectsWithDestinationPolicy(orgID string, received bool) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicy returns the list of all the objects that have a Destination Policy If received is true, return objects marked as policy received

func (*InMemoryStorage) RetrieveObjectsWithDestinationPolicyByService

func (store *InMemoryStorage) RetrieveObjectsWithDestinationPolicyByService(orgID, serviceOrgID, serviceName string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyByService returns the list of all the object Policies for a particular service

func (*InMemoryStorage) RetrieveObjectsWithDestinationPolicyUpdatedSince

func (store *InMemoryStorage) RetrieveObjectsWithDestinationPolicyUpdatedSince(orgID string, since int64) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyUpdatedSince returns the list of all the objects that have a Destination Policy updated since the specified time

func (*InMemoryStorage) RetrieveObjectsWithFilters

func (store *InMemoryStorage) RetrieveObjectsWithFilters(orgID string, destinationPolicy *bool, dpServiceOrgID string, dpServiceName string, dpPropertyName string, since int64, objectType string, objectID string, destinationType string, destinationID string, noData *bool, expirationTimeBefore string, deleted *bool) ([]common.MetaData, common.SyncServiceError)

RetrieveObjectsWithFilters returns the list of all othe objects that meet the given conditions

func (*InMemoryStorage) RetrieveOrganizationInfo

func (store *InMemoryStorage) RetrieveOrganizationInfo(orgID string) (*common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizationInfo retrieves organization information

func (*InMemoryStorage) RetrieveOrganizations

func (store *InMemoryStorage) RetrieveOrganizations() ([]common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizations retrieves stored organizations' info

func (*InMemoryStorage) RetrievePendingNotifications

func (store *InMemoryStorage) RetrievePendingNotifications(orgID string, destType string, destID string) ([]common.Notification, common.SyncServiceError)

RetrievePendingNotifications returns the list of pending notifications that are waiting to be sent to the destination

func (*InMemoryStorage) RetrieveTimeOnServer

func (store *InMemoryStorage) RetrieveTimeOnServer() (time.Time, error)

RetrieveTimeOnServer retrieves the current time on the database server

func (*InMemoryStorage) RetrieveUpdatedMessagingGroups

func (store *InMemoryStorage) RetrieveUpdatedMessagingGroups(time time.Time) ([]common.MessagingGroup, common.SyncServiceError)

RetrieveUpdatedMessagingGroups retrieves messaging groups that were updated after the specified time

func (*InMemoryStorage) RetrieveUpdatedObjects

func (store *InMemoryStorage) RetrieveUpdatedObjects(orgID string, objectType string, received bool) ([]common.MetaData, common.SyncServiceError)

RetrieveUpdatedObjects returns the list of all the edge updated objects that are not marked as consumed or received If received is true, return objects marked as received

func (*InMemoryStorage) RetrieveUpdatedOrganizations

func (store *InMemoryStorage) RetrieveUpdatedOrganizations(time time.Time) ([]common.StoredOrganization, common.SyncServiceError)

RetrieveUpdatedOrganizations retrieves organizations that were updated after the specified time

func (*InMemoryStorage) RetrieveWebhooks

func (store *InMemoryStorage) RetrieveWebhooks(orgID string, objectType string) ([]string, common.SyncServiceError)

RetrieveWebhooks gets the webhooks for the object type

func (*InMemoryStorage) Stop

func (store *InMemoryStorage) Stop()

Stop stops the InMemory store

func (*InMemoryStorage) StoreDestination

func (store *InMemoryStorage) StoreDestination(destination common.Destination) common.SyncServiceError

StoreDestination stores a destination

func (*InMemoryStorage) StoreObject

func (store *InMemoryStorage) StoreObject(metaData common.MetaData, data []byte, status string) ([]common.StoreDestinationStatus, common.SyncServiceError)

StoreObject stores an object

func (*InMemoryStorage) StoreObjectData

func (store *InMemoryStorage) StoreObjectData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

StoreObjectData stores an object's data Return true if the object was found and updated Return false and no error, if the object doesn't exist

func (*InMemoryStorage) StoreObjectTempData added in v1.6.2

func (store *InMemoryStorage) StoreObjectTempData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

func (*InMemoryStorage) StoreOrgToMessagingGroup

func (store *InMemoryStorage) StoreOrgToMessagingGroup(orgID string, messagingGroup string) common.SyncServiceError

StoreOrgToMessagingGroup inserts organization to messaging groups table

func (*InMemoryStorage) StoreOrganization

func (store *InMemoryStorage) StoreOrganization(org common.Organization) (time.Time, common.SyncServiceError)

StoreOrganization stores organization information Returns the stored record timestamp for multiple CSS updates

func (*InMemoryStorage) UpdateDestinationLastPingTime

func (store *InMemoryStorage) UpdateDestinationLastPingTime(destination common.Destination) common.SyncServiceError

UpdateDestinationLastPingTime updates the last ping time for the destination

func (*InMemoryStorage) UpdateLeader

func (store *InMemoryStorage) UpdateLeader(leaderID string, version int64) (bool, common.SyncServiceError)

UpdateLeader updates the leader entry for a leadership takeover

func (*InMemoryStorage) UpdateNotificationRecord

func (store *InMemoryStorage) UpdateNotificationRecord(notification common.Notification) common.SyncServiceError

UpdateNotificationRecord updates/adds a notification record to the object

func (*InMemoryStorage) UpdateNotificationResendTime

func (store *InMemoryStorage) UpdateNotificationResendTime(notification common.Notification) common.SyncServiceError

UpdateNotificationResendTime sets the resend time of the notification to common.Configuration.ResendInterval*6

func (*InMemoryStorage) UpdateObjectDelivering

func (store *InMemoryStorage) UpdateObjectDelivering(orgID string, objectType string, objectID string) common.SyncServiceError

UpdateObjectDelivering marks the object as being delivered to all its destinations

func (*InMemoryStorage) UpdateObjectDeliveryStatus

func (store *InMemoryStorage) UpdateObjectDeliveryStatus(status string, message string, orgID string, objectType string, objectID string,
	destType string, destID string) (bool, common.SyncServiceError)

UpdateObjectDeliveryStatus changes the object's delivery status for the destination Returns true if the status is Deleted and all the destinations are in status Deleted

func (*InMemoryStorage) UpdateObjectDestinations

func (store *InMemoryStorage) UpdateObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, []common.StoreDestinationStatus, common.SyncServiceError)

UpdateObjectDestinations updates object's destinations Returns the meta data, object's status, an array of deleted destinations, and an array of added destinations

func (*InMemoryStorage) UpdateObjectSourceDataURI

func (store *InMemoryStorage) UpdateObjectSourceDataURI(orgID string, objectType string, objectID string, sourceDataURI string) common.SyncServiceError

UpdateObjectSourceDataURI updates object's source data URI

func (*InMemoryStorage) UpdateObjectStatus

func (store *InMemoryStorage) UpdateObjectStatus(orgID string, objectType string, objectID string, status string) common.SyncServiceError

UpdateObjectStatus updates an object's status

func (*InMemoryStorage) UpdateRemovedDestinationPolicyServices

func (store *InMemoryStorage) UpdateRemovedDestinationPolicyServices(orgID string, objectType string, objectID string, destinationPolicyServices []common.ServiceID) common.SyncServiceError

UpdateRemovedDestinationPolicyServices update the removedDestinationPolicyServices, only for ESS

type MongoStorage

type MongoStorage struct {
	// contains filtered or unexported fields
}

MongoStorage is a MongoDB based store

func (*MongoStorage) ActivateObject

func (store *MongoStorage) ActivateObject(orgID string, objectType string, objectID string) common.SyncServiceError

ActivateObject marks object as active

func (*MongoStorage) AddObjectDestinations added in v1.6.5

func (store *MongoStorage) AddObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string, []common.StoreDestinationStatus, common.SyncServiceError)

AddObjectdestinations adds the destinations to object's destination list Returns the metadata, object's status, an array of added destinations after removing the overlapped destinations

func (*MongoStorage) AddUsersToACL

func (store *MongoStorage) AddUsersToACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

AddUsersToACL adds users to an ACL

func (*MongoStorage) AddWebhook

func (store *MongoStorage) AddWebhook(orgID string, objectType string, url string) common.SyncServiceError

AddWebhook stores a webhook for an object type

func (*MongoStorage) AppendObjectData

func (store *MongoStorage) AppendObjectData(orgID string, objectType string, objectID string, dataReader io.Reader,
	dataLength uint32, offset int64, total int64, isFirstChunk bool, isLastChunk bool, isTempData bool) (bool, common.SyncServiceError)

AppendObjectData appends a chunk of data to the object's data. Design is that each chunk will be written to a new document in mongo and then combined into final document by user caller RetrieveObjectTempData during verification step (or just copied if no verification necessary)

func (*MongoStorage) CleanObjects

func (store *MongoStorage) CleanObjects() common.SyncServiceError

CleanObjects removes the objects received from the other side. For persistant storage only partially recieved objects are removed.

func (*MongoStorage) Cleanup

func (store *MongoStorage) Cleanup(isTest bool) common.SyncServiceError

Cleanup erase the on disk Bolt database only for ESS and test

func (*MongoStorage) CloseDataReader

func (store *MongoStorage) CloseDataReader(dataReader io.Reader) common.SyncServiceError

CloseDataReader closes the data reader if necessary

func (*MongoStorage) DecrementAndReturnRemainingConsumers

func (store *MongoStorage) DecrementAndReturnRemainingConsumers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingConsumers decrements the number of remaining consumers of the object

func (*MongoStorage) DecrementAndReturnRemainingReceivers

func (store *MongoStorage) DecrementAndReturnRemainingReceivers(orgID string, objectType string, objectID string) (int,
	common.SyncServiceError)

DecrementAndReturnRemainingReceivers decrements the number of remaining receivers of the object

func (*MongoStorage) DeleteDestination

func (store *MongoStorage) DeleteDestination(orgID string, destType string, destID string) common.SyncServiceError

DeleteDestination deletes the destination

func (*MongoStorage) DeleteNotificationRecords

func (store *MongoStorage) DeleteNotificationRecords(orgID string, objectType string, objectID string, destType string, destID string) common.SyncServiceError

DeleteNotificationRecords deletes notification records to an object

func (*MongoStorage) DeleteObjectDestinations added in v1.6.5

func (store *MongoStorage) DeleteObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string, []common.StoreDestinationStatus, common.SyncServiceError)

DeleteObjectdestinations deletes the destinations from object's destination list Returns the metadata, objects' status, an array of destinations that removed from the current destination list

func (*MongoStorage) DeleteOrgToMessagingGroup

func (store *MongoStorage) DeleteOrgToMessagingGroup(orgID string) common.SyncServiceError

DeleteOrgToMessagingGroup deletes organization from messaging groups table

func (*MongoStorage) DeleteOrganization

func (store *MongoStorage) DeleteOrganization(orgID string) common.SyncServiceError

DeleteOrganization cleans up the storage from all the records associated with the organization

func (*MongoStorage) DeleteOrganizationInfo

func (store *MongoStorage) DeleteOrganizationInfo(orgID string) common.SyncServiceError

DeleteOrganizationInfo deletes organization information

func (*MongoStorage) DeleteStoredData

func (store *MongoStorage) DeleteStoredData(orgID string, objectType string, objectID string, isTempData bool) common.SyncServiceError

DeleteStoredData deletes the object's data

func (*MongoStorage) DeleteStoredObject

func (store *MongoStorage) DeleteStoredObject(orgID string, objectType string, objectID string) common.SyncServiceError

DeleteStoredObject deletes the object

func (*MongoStorage) DeleteWebhook

func (store *MongoStorage) DeleteWebhook(orgID string, objectType string, url string) common.SyncServiceError

DeleteWebhook deletes a webhook for an object type

func (*MongoStorage) DestinationExists

func (store *MongoStorage) DestinationExists(orgID string, destType string, destID string) (bool, common.SyncServiceError)

DestinationExists returns true if the destination exists, and false otherwise

func (*MongoStorage) GetNumberOfDestinations

func (store *MongoStorage) GetNumberOfDestinations() (uint32, common.SyncServiceError)

GetNumberOfDestinations returns the number of currently registered ESS nodes (for CSS)

func (*MongoStorage) GetNumberOfStoredObjects

func (store *MongoStorage) GetNumberOfStoredObjects() (uint32, common.SyncServiceError)

GetNumberOfStoredObjects returns the number of objects received from the application that are currently stored in this node's storage

func (*MongoStorage) GetObjectDestinations

func (store *MongoStorage) GetObjectDestinations(metaData common.MetaData) ([]common.Destination, common.SyncServiceError)

GetObjectDestinations gets destinations that the object has to be sent to

func (*MongoStorage) GetObjectDestinationsList

func (store *MongoStorage) GetObjectDestinationsList(orgID string, objectType string,
	objectID string) ([]common.StoreDestinationStatus, common.SyncServiceError)

GetObjectDestinationsList gets destinations that the object has to be sent to and their status

func (*MongoStorage) GetObjectsForDestination

func (store *MongoStorage) GetObjectsForDestination(orgID string, destType string, destID string) ([]common.ObjectStatus, common.SyncServiceError)

GetObjectsForDestination retrieves objects that are in use on a given node

func (*MongoStorage) GetObjectsToActivate

func (store *MongoStorage) GetObjectsToActivate() ([]common.MetaData, common.SyncServiceError)

GetObjectsToActivate returns inactive objects that are ready to be activated

func (*MongoStorage) HandleObjectInfoForLastDataChunk added in v1.6.8

func (store *MongoStorage) HandleObjectInfoForLastDataChunk(orgID string, objectType string, objectID string, isTempData bool, dataSize int64) (bool, common.SyncServiceError)

Handles the last data chunk when no data verification needed

func (*MongoStorage) Init

func (store *MongoStorage) Init() common.SyncServiceError

Init initializes the MongoStorage store

func (*MongoStorage) InsertInitialLeader

func (store *MongoStorage) InsertInitialLeader(leaderID string) (bool, common.SyncServiceError)

InsertInitialLeader inserts the initial leader document if the collection is empty

func (*MongoStorage) IsConnected

func (store *MongoStorage) IsConnected() bool

IsConnected returns false if the storage cannont be reached, and true otherwise

func (*MongoStorage) IsPersistent

func (store *MongoStorage) IsPersistent() bool

IsPersistent returns true if the storage is persistent, and false otherwise

func (*MongoStorage) LeaderPeriodicUpdate

func (store *MongoStorage) LeaderPeriodicUpdate(leaderID string) (bool, common.SyncServiceError)

LeaderPeriodicUpdate does the periodic update of the leader document by the leader

func (*MongoStorage) MarkDestinationPolicyReceived

func (store *MongoStorage) MarkDestinationPolicyReceived(orgID string, objectType string, objectID string) common.SyncServiceError

MarkDestinationPolicyReceived marks an object's destination policy as having been received

func (*MongoStorage) MarkObjectDeleted

func (store *MongoStorage) MarkObjectDeleted(orgID string, objectType string, objectID string) common.SyncServiceError

MarkObjectDeleted marks the object as deleted

func (*MongoStorage) PerformMaintenance

func (store *MongoStorage) PerformMaintenance()

PerformMaintenance performs store's maintenance

func (*MongoStorage) ReadObjectData

func (store *MongoStorage) ReadObjectData(orgID string, objectType string, objectID string, size int, offset int64) ([]byte, bool, int, common.SyncServiceError)

ReadObjectData returns the object data with the specified parameters

func (*MongoStorage) RemoveInactiveDestinations

func (store *MongoStorage) RemoveInactiveDestinations(lastTimestamp time.Time)

RemoveInactiveDestinations removes destinations that haven't sent ping since the provided timestamp

func (*MongoStorage) RemoveObjectTempData added in v1.6.2

func (store *MongoStorage) RemoveObjectTempData(orgID string, objectType string, objectID string) common.SyncServiceError

Removes all the temporary chunk files from Mongo. Depends on RetrieveObjectTempData putting the fileHandle of the temp file into the map The verification step will be done by the CSS that opened all the files so should have the correct mapping

func (*MongoStorage) RemoveUsersFromACL

func (store *MongoStorage) RemoveUsersFromACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

RemoveUsersFromACL removes users from an ACL

func (*MongoStorage) ResetObjectRemainingConsumers

func (store *MongoStorage) ResetObjectRemainingConsumers(orgID string, objectType string, objectID string) common.SyncServiceError

ResetObjectRemainingConsumers sets the remaining consumers count to the original ExpectedConsumers value

func (*MongoStorage) ResignLeadership

func (store *MongoStorage) ResignLeadership(leaderID string) common.SyncServiceError

ResignLeadership causes this sync service to give up the Leadership

func (*MongoStorage) RetrieveACL

func (store *MongoStorage) RetrieveACL(aclType string, orgID string, key string, aclUserType string) ([]common.ACLentry, common.SyncServiceError)

RetrieveACL retrieves the list of usernames on an ACL

func (*MongoStorage) RetrieveACLsInOrg

func (store *MongoStorage) RetrieveACLsInOrg(aclType string, orgID string) ([]string, common.SyncServiceError)

RetrieveACLsInOrg retrieves the list of ACLs in an organization

func (*MongoStorage) RetrieveAllObjects

func (store *MongoStorage) RetrieveAllObjects(orgID string, objectType string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveAllObjects returns the list of all the objects of the specified type

func (*MongoStorage) RetrieveAllObjectsAndUpdateDestinationListForDestination

func (store *MongoStorage) RetrieveAllObjectsAndUpdateDestinationListForDestination(destOrgID string, destType string, destID string) ([]common.MetaData, common.SyncServiceError)

RetrieveAllObjectsAndUpdateDestinationListForDestination retrieves objects that are in use on a given node and the destination status

func (*MongoStorage) RetrieveConsumedObjects

func (store *MongoStorage) RetrieveConsumedObjects() ([]common.ConsumedObject, common.SyncServiceError)

RetrieveConsumedObjects returns all the consumed objects originated from this node ESS only API

func (*MongoStorage) RetrieveDestination

func (store *MongoStorage) RetrieveDestination(orgID string, destType string, destID string) (*common.Destination, common.SyncServiceError)

RetrieveDestination retrieves a destination

func (*MongoStorage) RetrieveDestinationProtocol

func (store *MongoStorage) RetrieveDestinationProtocol(orgID string, destType string, destID string) (string, common.SyncServiceError)

RetrieveDestinationProtocol retrieves the communication protocol for the destination

func (*MongoStorage) RetrieveDestinations

func (store *MongoStorage) RetrieveDestinations(orgID string, destType string) ([]common.Destination, common.SyncServiceError)

RetrieveDestinations returns all the destinations with the provided orgID and destType

func (*MongoStorage) RetrieveLeader

func (store *MongoStorage) RetrieveLeader() (string, int32, time.Time, int64, common.SyncServiceError)

RetrieveLeader retrieves the Heartbeat timeout and Last heartbeat time stamp from the leader document

func (*MongoStorage) RetrieveMessagingGroup

func (store *MongoStorage) RetrieveMessagingGroup(orgID string) (string, common.SyncServiceError)

RetrieveMessagingGroup retrieves messaging group for organization

func (*MongoStorage) RetrieveNotificationRecord

func (store *MongoStorage) RetrieveNotificationRecord(orgID string, objectType string, objectID string, destType string,
	destID string) (*common.Notification, common.SyncServiceError)

RetrieveNotificationRecord retrieves notification

func (*MongoStorage) RetrieveNotifications

func (store *MongoStorage) RetrieveNotifications(orgID string, destType string, destID string, retrieveReceived bool) ([]common.Notification, common.SyncServiceError)

RetrieveNotifications returns the list of all the notifications that need to be resent to the destination

func (*MongoStorage) RetrieveObjOrDestTypeForGivenACLUser added in v0.10.12

func (store *MongoStorage) RetrieveObjOrDestTypeForGivenACLUser(aclType string, orgID string, aclUserType string, aclUsername string, aclRole string) ([]string, common.SyncServiceError)

RetrieveObjOrDestTypeForGivenACLUser retrieves object types that given acl user has access to

func (*MongoStorage) RetrieveObject

func (store *MongoStorage) RetrieveObject(orgID string, objectType string, objectID string) (*common.MetaData, common.SyncServiceError)

RetrieveObject returns the object meta data with the specified parameters

func (*MongoStorage) RetrieveObjectAndRemovedDestinationPolicyServices

func (store *MongoStorage) RetrieveObjectAndRemovedDestinationPolicyServices(orgID string, objectType string, objectID string) (*common.MetaData, []common.ServiceID, common.SyncServiceError)

RetrieveObjectAndRemovedDestinationPolicyServices returns the object metadata and removedDestinationPolicyServices with the specified param, only for ESS

func (*MongoStorage) RetrieveObjectAndStatus

func (store *MongoStorage) RetrieveObjectAndStatus(orgID string, objectType string, objectID string) (*common.MetaData, string, common.SyncServiceError)

RetrieveObjectAndStatus returns the object meta data and status with the specified parameters

func (*MongoStorage) RetrieveObjectData

func (store *MongoStorage) RetrieveObjectData(orgID string, objectType string, objectID string, isTempData bool) (io.Reader, common.SyncServiceError)

RetrieveObjectData returns the object data with the specified parameters

func (*MongoStorage) RetrieveObjectRemainingConsumers

func (store *MongoStorage) RetrieveObjectRemainingConsumers(orgID string, objectType string, objectID string) (int, common.SyncServiceError)

RetrieveObjectRemainingConsumers finds the object and returns the number remaining consumers that haven't consumed the object yet

func (*MongoStorage) RetrieveObjectStatus

func (store *MongoStorage) RetrieveObjectStatus(orgID string, objectType string, objectID string) (string, common.SyncServiceError)

RetrieveObjectStatus finds the object and return its status

func (*MongoStorage) RetrieveObjectTempData added in v1.6.8

func (store *MongoStorage) RetrieveObjectTempData(orgID string, objectType string, objectID string) (io.Reader, common.SyncServiceError)

For mongo implementation, each chunk is saved to a separate document. In this method, we have to combine all those documents into a MultiReader

func (*MongoStorage) RetrieveObjects

func (store *MongoStorage) RetrieveObjects(orgID string, destType string, destID string, resend int) ([]common.MetaData, common.SyncServiceError)

RetrieveObjects returns the list of all the objects that need to be sent to the destination. Adds the new destination to the destinations lists of the relevant objects.

func (*MongoStorage) RetrieveObjectsWithDestinationPolicy

func (store *MongoStorage) RetrieveObjectsWithDestinationPolicy(orgID string, received bool) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicy returns the list of all the objects that have a Destination Policy If received is true, return objects marked as policy received

func (*MongoStorage) RetrieveObjectsWithDestinationPolicyByService

func (store *MongoStorage) RetrieveObjectsWithDestinationPolicyByService(orgID, serviceOrgID, serviceName string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyByService returns the list of all the object Policies for a particular service

func (*MongoStorage) RetrieveObjectsWithDestinationPolicyUpdatedSince

func (store *MongoStorage) RetrieveObjectsWithDestinationPolicyUpdatedSince(orgID string, since int64) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

RetrieveObjectsWithDestinationPolicyUpdatedSince returns the list of all the objects that have a Destination Policy updated since the specified time

func (*MongoStorage) RetrieveObjectsWithFilters

func (store *MongoStorage) RetrieveObjectsWithFilters(orgID string, destinationPolicy *bool, dpServiceOrgID string, dpServiceName string, dpPropertyName string, since int64, objectType string, objectID string, destinationType string, destinationID string, noData *bool, expirationTimeBefore string, deleted *bool) ([]common.MetaData, common.SyncServiceError)

RetrieveObjectsWithFilters returns the list of all the objects that meet the given conditions

func (*MongoStorage) RetrieveOrganizationInfo

func (store *MongoStorage) RetrieveOrganizationInfo(orgID string) (*common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizationInfo retrieves organization information

func (*MongoStorage) RetrieveOrganizations

func (store *MongoStorage) RetrieveOrganizations() ([]common.StoredOrganization, common.SyncServiceError)

RetrieveOrganizations retrieves stored organizations' info

func (*MongoStorage) RetrievePendingNotifications

func (store *MongoStorage) RetrievePendingNotifications(orgID string, destType string, destID string) ([]common.Notification, common.SyncServiceError)

RetrievePendingNotifications returns the list of pending notifications that are waiting to be sent to the destination

func (*MongoStorage) RetrieveTimeOnServer

func (store *MongoStorage) RetrieveTimeOnServer() (time.Time, error)

RetrieveTimeOnServer retrieves the current time on the database server

func (*MongoStorage) RetrieveUpdatedMessagingGroups

func (store *MongoStorage) RetrieveUpdatedMessagingGroups(time time.Time) ([]common.MessagingGroup,
	common.SyncServiceError)

RetrieveUpdatedMessagingGroups retrieves messaging groups that were updated after the specified time

func (*MongoStorage) RetrieveUpdatedObjects

func (store *MongoStorage) RetrieveUpdatedObjects(orgID string, objectType string, received bool) ([]common.MetaData, common.SyncServiceError)

RetrieveUpdatedObjects returns the list of all the edge updated objects that are not marked as consumed or received If received is true, return objects marked as received

func (*MongoStorage) RetrieveUpdatedOrganizations

func (store *MongoStorage) RetrieveUpdatedOrganizations(time time.Time) ([]common.StoredOrganization, common.SyncServiceError)

RetrieveUpdatedOrganizations retrieves organizations that were updated after the specified time

func (*MongoStorage) RetrieveWebhooks

func (store *MongoStorage) RetrieveWebhooks(orgID string, objectType string) ([]string, common.SyncServiceError)

RetrieveWebhooks gets the webhooks for the object type

func (*MongoStorage) Stop

func (store *MongoStorage) Stop()

Stop stops the MongoStorage store

func (*MongoStorage) StoreDestination

func (store *MongoStorage) StoreDestination(destination common.Destination) common.SyncServiceError

StoreDestination stores the destination

func (*MongoStorage) StoreObject

func (store *MongoStorage) StoreObject(metaData common.MetaData, data []byte, status string) ([]common.StoreDestinationStatus, common.SyncServiceError)

StoreObject stores an object If the object already exists, return the changes in its destinations list (for CSS) - return the list of deleted destinations

func (*MongoStorage) StoreObjectData

func (store *MongoStorage) StoreObjectData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

StoreObjectData stores object's data Return true if the object was found and updated Return false and no error, if the object doesn't exist

func (*MongoStorage) StoreObjectTempData added in v1.6.2

func (store *MongoStorage) StoreObjectTempData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

func (*MongoStorage) StoreOrgToMessagingGroup

func (store *MongoStorage) StoreOrgToMessagingGroup(orgID string, messagingGroup string) common.SyncServiceError

StoreOrgToMessagingGroup inserts organization to messaging groups table

func (*MongoStorage) StoreOrganization

func (store *MongoStorage) StoreOrganization(org common.Organization) (time.Time, common.SyncServiceError)

StoreOrganization stores organization information Returns the stored record timestamp for multiple CSS updates

func (*MongoStorage) UpdateDestinationLastPingTime

func (store *MongoStorage) UpdateDestinationLastPingTime(destination common.Destination) common.SyncServiceError

UpdateDestinationLastPingTime updates the last ping time for the destination

func (*MongoStorage) UpdateLeader

func (store *MongoStorage) UpdateLeader(leaderID string, version int64) (bool, common.SyncServiceError)

UpdateLeader updates the leader entry for a leadership takeover

func (*MongoStorage) UpdateNotificationRecord

func (store *MongoStorage) UpdateNotificationRecord(notification common.Notification) common.SyncServiceError

UpdateNotificationRecord updates/adds a notification record to the object

func (*MongoStorage) UpdateNotificationResendTime

func (store *MongoStorage) UpdateNotificationResendTime(notification common.Notification) common.SyncServiceError

UpdateNotificationResendTime sets the resend time of the notification to common.Configuration.ResendInterval*6

func (*MongoStorage) UpdateObjectDelivering

func (store *MongoStorage) UpdateObjectDelivering(orgID string, objectType string, objectID string) common.SyncServiceError

UpdateObjectDelivering marks the object as being delivered to all its destinations

func (*MongoStorage) UpdateObjectDeliveryStatus

func (store *MongoStorage) UpdateObjectDeliveryStatus(status string, message string, orgID string, objectType string, objectID string,
	destType string, destID string) (bool, common.SyncServiceError)

UpdateObjectDeliveryStatus changes the object's delivery status and message for the destination Returns true if the status is Deleted and all the destinations are in status Deleted

func (*MongoStorage) UpdateObjectDestinations

func (store *MongoStorage) UpdateObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
	[]common.StoreDestinationStatus, []common.StoreDestinationStatus, common.SyncServiceError)

UpdateObjectDestinations updates object's destinations Returns the meta data, object's status, an array of deleted destinations, and an array of added destinations

func (*MongoStorage) UpdateObjectSourceDataURI

func (store *MongoStorage) UpdateObjectSourceDataURI(orgID string, objectType string, objectID string, sourceDataURI string) common.SyncServiceError

UpdateObjectSourceDataURI updates object's source data URI

func (*MongoStorage) UpdateObjectStatus

func (store *MongoStorage) UpdateObjectStatus(orgID string, objectType string, objectID string, status string) common.SyncServiceError

UpdateObjectStatus updates object's status

func (*MongoStorage) UpdateRemovedDestinationPolicyServices

func (store *MongoStorage) UpdateRemovedDestinationPolicyServices(orgID string, objectType string, objectID string, destinationPolicyServices []common.ServiceID) common.SyncServiceError

UpdateRemovedDestinationPolicyServices update the removedDestinationPolicyServices, only for ESS

type NotConnected

type NotConnected struct {
	// contains filtered or unexported fields
}

NotConnected is the error returned if there is no connection to the database

func (*NotConnected) Error

func (e *NotConnected) Error() string

type NotFound

type NotFound struct {
	// contains filtered or unexported fields
}

NotFound is the error returned if an object wasn't found

func (*NotFound) Error

func (e *NotFound) Error() string

type Storage

type Storage interface {
	// Initialize the store
	Init() common.SyncServiceError

	// Stop the store
	Stop()

	// PerformMaintenance performs store's maintenance
	PerformMaintenance()

	// Cleanup erase the on disk Bolt databass only for ESS and test
	Cleanup(isTest bool) common.SyncServiceError

	// Store an object
	// If the object already exists, return the changes in its destinations list (for CSS) - return the list of deleted destinations
	StoreObject(metaData common.MetaData, data []byte, status string) ([]common.StoreDestinationStatus, common.SyncServiceError)

	// Store object's data
	// Return true if the object was found and updated
	// Return false and no error, if the object doesn't exist
	StoreObjectData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

	StoreObjectTempData(orgID string, objectType string, objectID string, dataReader io.Reader) (bool, common.SyncServiceError)

	RemoveObjectTempData(orgID string, objectType string, objectID string) common.SyncServiceError

	RetrieveObjectTempData(orgID string, objectType string, objectID string) (io.Reader, common.SyncServiceError)

	// Append a chunk of data to the object's data
	AppendObjectData(orgID string, objectType string, objectID string, dataReader io.Reader, dataLength uint32, offset int64, total int64, isFirstChunk bool, isLastChunk bool, isTempData bool) (bool, common.SyncServiceError)

	// Handles the last data chunk
	HandleObjectInfoForLastDataChunk(orgID string, objectType string, objectID string, isTempData bool, dataSize int64) (bool, common.SyncServiceError)

	// Update object's status
	UpdateObjectStatus(orgID string, objectType string, objectID string, status string) common.SyncServiceError

	// Update object's source data URI
	UpdateObjectSourceDataURI(orgID string, objectType string, objectID string, sourceDataURI string) common.SyncServiceError

	// Find the object and return its status
	RetrieveObjectStatus(orgID string, objectType string, objectID string) (string, common.SyncServiceError)

	// Find the object and return the number of remaining consumers that haven't consumed the object yet
	RetrieveObjectRemainingConsumers(orgID string, objectType string, objectID string) (int, common.SyncServiceError)

	// Decrement the number of remaining consumers of the object
	DecrementAndReturnRemainingConsumers(orgID string, objectType string, objectID string) (int, common.SyncServiceError)

	// Decrement the number of remaining receivers of the object
	DecrementAndReturnRemainingReceivers(orgID string, objectType string, objectID string) (int, common.SyncServiceError)

	// Sets the remaining consumers count to the original ExpectedConsumers value
	ResetObjectRemainingConsumers(orgID string, objectType string, objectID string) common.SyncServiceError

	// Return the list of all the edge updated objects that are not marked as consumed or received
	// If received is true, return objects marked as received
	RetrieveUpdatedObjects(orgID string, objectType string, received bool) ([]common.MetaData, common.SyncServiceError)

	// RetrieveObjectsWithDestinationPolicy returns the list of all the objects that have a Destination Policy
	// If received is true, return objects marked as policy received
	RetrieveObjectsWithDestinationPolicy(orgID string, received bool) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

	// RetrieveObjectsWithDestinationPolicyByService returns the list of all the object Policies for a particular service
	RetrieveObjectsWithDestinationPolicyByService(orgID, serviceOrgID, serviceName string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

	// RetrieveObjectsWithDestinationPolicyUpdatedSince returns the list of all the objects that have a Destination Policy updated since the specified time
	RetrieveObjectsWithDestinationPolicyUpdatedSince(orgID string, since int64) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

	// RetrieveObjectsWithFilters returns the list of all othe objects that meet the given conditions
	RetrieveObjectsWithFilters(orgID string, destinationPolicy *bool, dpServiceOrgID string, dpServiceName string, dpPropertyName string, since int64, objectType string, objectID string, destinationType string, destinationID string, noData *bool, expirationTimeBefore string, deleted *bool) ([]common.MetaData, common.SyncServiceError)

	// RetrieveAllObjects returns the list of all the objects of the specified type
	RetrieveAllObjects(orgID string, objectType string) ([]common.ObjectDestinationPolicy, common.SyncServiceError)

	// Return the list of all the objects that need to be sent to the destination
	RetrieveObjects(orgID string, destType string, destID string, resend int) ([]common.MetaData, common.SyncServiceError)

	// RetrieveConsumedObjects returns all the consumed objects originated from this node
	RetrieveConsumedObjects() ([]common.ConsumedObject, common.SyncServiceError)

	// Return the object meta data with the specified parameters
	RetrieveObject(orgID string, objectType string, objectID string) (*common.MetaData, common.SyncServiceError)

	// Return the object meta data and status with the specified parameters
	RetrieveObjectAndStatus(orgID string, objectType string, objectID string) (*common.MetaData, string, common.SyncServiceError)

	// Return the object data with the specified parameters
	RetrieveObjectData(orgID string, objectType string, objectID string, isTempData bool) (io.Reader, common.SyncServiceError)

	// Return the object data with the specified parameters
	ReadObjectData(orgID string, objectType string, objectID string, size int, offset int64) ([]byte, bool, int, common.SyncServiceError)

	// Close the data reader if necessary
	CloseDataReader(dataReader io.Reader) common.SyncServiceError

	// Marks the object as deleted
	MarkObjectDeleted(orgID string, objectType string, objectID string) common.SyncServiceError

	// Mark an object's destination policy as having been received
	MarkDestinationPolicyReceived(orgID string, objectType string, objectID string) common.SyncServiceError

	// Mark object as active
	ActivateObject(orgID string, objectType string, objectID string) common.SyncServiceError

	// GetObjectsToActivate returns inactive objects that are ready to be activated
	GetObjectsToActivate() ([]common.MetaData, common.SyncServiceError)

	// Delete the object
	DeleteStoredObject(orgID string, objectType string, objectID string) common.SyncServiceError

	// Delete the object's data
	DeleteStoredData(orgID string, objectType string, objectID string, isTempData bool) common.SyncServiceError

	// CleanObjects removes the objects received from the other side.
	// For persistant storage only partially recieved objects are removed.
	CleanObjects() common.SyncServiceError

	// Get destinations that the object has to be sent to
	GetObjectDestinations(metaData common.MetaData) ([]common.Destination, common.SyncServiceError)

	// UpdateObjectDeliveryStatus changes the object's delivery status for the destination
	// Returns true if the status is Deleted and all the destinations are in status Deleted
	UpdateObjectDeliveryStatus(status string, message string, orgID string, objectType string, objectID string,
		destType string, destID string) (bool, common.SyncServiceError)

	// UpdateObjectDelivering marks the object as being delivered to all its destinations
	UpdateObjectDelivering(orgID string, objectType string, objectID string) common.SyncServiceError

	// GetObjectDestinationsList gets destinations that the object has to be sent to and their status
	GetObjectDestinationsList(orgID string, objectType string,
		objectID string) ([]common.StoreDestinationStatus, common.SyncServiceError)

	// UpdateObjectDestinations updates object's destinations
	// Returns the meta data, object's status, an array of deleted destinations, and an array of added destinations
	UpdateObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
		[]common.StoreDestinationStatus, []common.StoreDestinationStatus, common.SyncServiceError)

	// AddObjectdestinations adds the destinations to object's destination list
	// Returns the metadata, object's status, an array of added destinations after removing the overlapped destinations
	AddObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
		[]common.StoreDestinationStatus, common.SyncServiceError)

	// DeleteObjectdestinations deletes the destinations from object's destination list
	// Returns the metadata, objects' status, an array of destinations that removed from the current destination list
	DeleteObjectDestinations(orgID string, objectType string, objectID string, destinationsList []string) (*common.MetaData, string,
		[]common.StoreDestinationStatus, common.SyncServiceError)

	// GetNumberOfStoredObjects returns the number of objects received from the application that are
	// currently stored in this node's storage
	GetNumberOfStoredObjects() (uint32, common.SyncServiceError)

	// AddWebhook stores a webhook for an object type
	AddWebhook(orgID string, objectType string, url string) common.SyncServiceError

	// DeleteWebhook deletes a webhook for an object type
	DeleteWebhook(orgID string, objectType string, url string) common.SyncServiceError

	// RetrieveWebhooks gets the webhooks for the object type
	RetrieveWebhooks(orgID string, objectType string) ([]string, common.SyncServiceError)

	// Return all the destinations with the provided orgID and destType
	RetrieveDestinations(orgID string, destType string) ([]common.Destination, common.SyncServiceError)

	// Return true if the destination exists, and false otherwise
	DestinationExists(orgID string, destType string, destID string) (bool, common.SyncServiceError)

	// Retrieve destination
	RetrieveDestination(orgID string, destType string, destID string) (*common.Destination, common.SyncServiceError)

	// Store the destination
	StoreDestination(destination common.Destination) common.SyncServiceError

	// Delete the destination
	DeleteDestination(orgID string, destType string, destID string) common.SyncServiceError

	// UpdateDestinationLastPingTime updates the last ping time for the destination
	UpdateDestinationLastPingTime(destination common.Destination) common.SyncServiceError

	// RemoveInactiveDestinations removes destinations that haven't sent ping since the provided timestamp
	RemoveInactiveDestinations(lastTimestamp time.Time)

	// GetNumberOfDestinations returns the number of currently registered ESS nodes (for CSS)
	GetNumberOfDestinations() (uint32, common.SyncServiceError)

	// Retrieve communication protocol for the destination
	RetrieveDestinationProtocol(orgID string, destType string, destID string) (string, common.SyncServiceError)

	// GetObjectsForDestination retrieves objects that are in use on a given node
	GetObjectsForDestination(orgID string, destType string, destID string) ([]common.ObjectStatus, common.SyncServiceError)

	// RetrieveAllObjectsAndUpdateDestinationListForDestination retrieves objects that are in use on a given node and returns the list of metadata
	RetrieveAllObjectsAndUpdateDestinationListForDestination(orgID string, destType string, destID string) ([]common.MetaData, common.SyncServiceError)

	// RetrieveObjectAndRemovedDestinationPolicyServices returns the object metadata and removedDestinationPolicyServices with the specified param, only for ESS
	RetrieveObjectAndRemovedDestinationPolicyServices(orgID string, objectType string, objectID string) (*common.MetaData, []common.ServiceID, common.SyncServiceError)

	// UpdateRemovedDestinationPolicyServices update the removedDestinationPolicyServices, only for ESS
	UpdateRemovedDestinationPolicyServices(orgID string, objectType string, objectID string, destinationPolicyServices []common.ServiceID) common.SyncServiceError

	// Update/add a notification record to an object
	UpdateNotificationRecord(notification common.Notification) common.SyncServiceError

	// UpdateNotificationResendTime sets the resend time of the notification to common.Configuration.ResendInterval*6
	UpdateNotificationResendTime(notification common.Notification) common.SyncServiceError

	// RetrieveNotificationRecord retrieves notification
	RetrieveNotificationRecord(orgID string, objectType string, objectID string, destType string, destID string) (*common.Notification, common.SyncServiceError)

	// Delete notification records to an object
	DeleteNotificationRecords(orgID string, objectType string, objectID string, destType string, destID string) common.SyncServiceError

	// Return the list of all the notifications that need to be resent to the destination
	RetrieveNotifications(orgID string, destType string, destID string, retrieveReceived bool) ([]common.Notification, common.SyncServiceError)

	// Return the list of pending notifications that are waiting to be sent to the destination
	RetrievePendingNotifications(orgID string, destType string, destID string) ([]common.Notification, common.SyncServiceError)

	// InsertInitialLeader inserts the initial leader document in the collection is empty
	InsertInitialLeader(leaderID string) (bool, common.SyncServiceError)

	// LeaderPeriodicUpdate does the periodic update of the leader document by the leader
	LeaderPeriodicUpdate(leaderID string) (bool, common.SyncServiceError)

	// RetrieveLeader retrieves the Heartbeat timeout and Last heartbeat time stamp from the leader document
	RetrieveLeader() (string, int32, time.Time, int64, common.SyncServiceError)

	// UpdateLeader updates the leader entry for a leadership takeover
	UpdateLeader(leaderID string, version int64) (bool, common.SyncServiceError)

	// ResignLeadership causes this sync service to give up the Leadership
	ResignLeadership(leaderID string) common.SyncServiceError

	// RetrieveTimeOnServer retrieves the current time on the database server
	RetrieveTimeOnServer() (time.Time, error)

	// StoreOrgToMessagingGroup inserts organization to messaging groups table
	StoreOrgToMessagingGroup(orgID string, messagingGroup string) common.SyncServiceError

	// DeleteOrgToMessagingGroup deletes organization from messaging groups table
	DeleteOrgToMessagingGroup(orgID string) common.SyncServiceError

	// RetrieveMessagingGroup retrieves messaging group for organization
	RetrieveMessagingGroup(orgID string) (string, common.SyncServiceError)

	// RetrieveUpdatedMessagingGroups retrieves messaging groups that were updated after the specified time
	RetrieveUpdatedMessagingGroups(time time.Time) ([]common.MessagingGroup, common.SyncServiceError)

	// DeleteOrganization cleans up the storage from all the records associated with the organization
	DeleteOrganization(orgID string) common.SyncServiceError

	// StoreOrganization stores organization information
	// Returns the stored record timestamp for multiple CSS updates
	StoreOrganization(org common.Organization) (time.Time, common.SyncServiceError)

	// RetrieveOrganizationInfo retrieves organization information
	RetrieveOrganizationInfo(orgID string) (*common.StoredOrganization, common.SyncServiceError)

	// DeleteOrganizationInfo deletes organization information
	DeleteOrganizationInfo(orgID string) common.SyncServiceError

	// RetrieveOrganizations retrieves stored organizations' info
	RetrieveOrganizations() ([]common.StoredOrganization, common.SyncServiceError)

	// RetrieveUpdatedOrganizations retrieves organizations that were updated after the specified time
	RetrieveUpdatedOrganizations(time time.Time) ([]common.StoredOrganization, common.SyncServiceError)

	// AddUsersToACL adds users to an ACL
	AddUsersToACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

	// RemoveUsersFromACL removes users from an ACL
	RemoveUsersFromACL(aclType string, orgID string, key string, users []common.ACLentry) common.SyncServiceError

	// RetrieveACL retrieves the list of usernames on an ACL
	RetrieveACL(aclType string, orgID string, key string, aclUserType string) ([]common.ACLentry, common.SyncServiceError)

	// RetrieveACLsInOrg retrieves the list of ACLs in an organization
	RetrieveACLsInOrg(aclType string, orgID string) ([]string, common.SyncServiceError)

	// RetrieveObjOrDestTypeForGivenACLUser retrieves object types that given acl user has access to
	RetrieveObjOrDestTypeForGivenACLUser(aclType string, orgID string, aclUserType string, aclUsername string, aclRole string) ([]string, common.SyncServiceError)

	// IsConnected returns false if the storage cannont be reached, and true otherwise
	IsConnected() bool

	// IsPersistent returns true if the storage is persistent, and false otherwise
	IsPersistent() bool
}

Storage is the interface for stores

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL