Example #1
0
func (cfg *PoolsConfig) writeToStore() error {
	if cfg.ds == nil {
		return nil
	}
	err := cfg.ds.PutObjectAtomic(cfg)
	if err == datastore.ErrKeyModified {
		return types.RetryErrorf("failed to perform atomic write (%v). retry might fix the error", err)
	}
	return err
}
Example #2
0
func (h *Handle) writeToStore() error {
	h.Lock()
	store := h.store
	h.Unlock()
	if store == nil {
		return nil
	}
	err := store.PutObjectAtomic(h)
	if err == datastore.ErrKeyModified {
		return types.RetryErrorf("failed to perform atomic write (%v). retry might fix the error", err)
	}
	return err
}
Example #3
0
func (a *Allocator) writeToStore(aSpace *addrSpace) error {
	store := aSpace.store()
	if store == nil {
		return types.InternalErrorf("invalid store while trying to write %s address space", aSpace.DataScope())
	}

	err := store.PutObjectAtomic(aSpace)
	if err == datastore.ErrKeyModified {
		return types.RetryErrorf("failed to perform atomic write (%v). retry might fix the error", err)
	}

	return err
}
Example #4
0
func (a *Allocator) writeToStore(aSpace *addrSpace) error {
	store := aSpace.store()

	// IPAM may not have a valid store. In such cases it is just in-memory state.
	if store == nil {
		return nil
	}

	err := store.PutObjectAtomic(aSpace)
	if err == datastore.ErrKeyModified {
		return types.RetryErrorf("failed to perform atomic write (%v). retry might fix the error", err)
	}

	return err
}