type UndeltaStore … var _ … // Add inserts an object into the store and sends complete state by calling PushFunc. // Note about thread safety. The Store implementation (cache.cache) uses a lock for all methods. // In the functions below, the lock gets released and reacquired betweend the {Add,Delete,etc} // and the List. So, the following can happen, resulting in two identical calls to PushFunc. // time thread 1 thread 2 // 0 UndeltaStore.Add(a) // 1 UndeltaStore.Add(b) // 2 Store.Add(a) // 3 Store.Add(b) // 4 Store.List() -> [a,b] // 5 Store.List() -> [a,b] func (u *UndeltaStore) Add(obj interface{ … } // Update sets an item in the cache to its updated state and sends complete state by calling PushFunc. func (u *UndeltaStore) Update(obj interface{ … } // Delete removes an item from the cache and sends complete state by calling PushFunc. func (u *UndeltaStore) Delete(obj interface{ … } // Replace will delete the contents of current store, using instead the given list. // 'u' takes ownership of the list, you should not reference the list again // after calling this function. // The new contents complete state will be sent by calling PushFunc after replacement. func (u *UndeltaStore) Replace(list []interface{ … } // NewUndeltaStore returns an UndeltaStore implemented with a Store. func NewUndeltaStore(pushFunc func([]interface{ … }