Beispiel #1
0
func (c *controller) updateToStore(kvObject datastore.KV) error {
	if kvObject.Skip() {
		return nil
	}
	cs := c.getDataStore(kvObject.DataScope())
	if cs == nil {
		log.Debugf("datastore not initialized. kv object %s is not added to the store", datastore.Key(kvObject.Key()...))
		return nil
	}

	return cs.PutObjectAtomic(kvObject)
}
Beispiel #2
0
func (c *controller) deleteFromStore(kvObject datastore.KV) error {
	if kvObject.Skip() {
		return nil
	}
	cs := c.getDataStore(kvObject.DataScope())
	if cs == nil {
		log.Debugf("datastore not initialized. kv object %s is not deleted from datastore", datastore.Key(kvObject.Key()...))
		return nil
	}

	if err := cs.DeleteObjectAtomic(kvObject); err != nil {
		return err
	}

	return nil
}