MM-14246 - Plugin framework: support transactional semantics with KV Store (#10634)

* MM-14246 - Plugin framework: support transactional semantics with KV Store

Rename old, new variable names

Moving New function to the bottom

* Made CompareAndUpdate sync, updated tests

* Removed going through channel in CompareAndSetPluginKey

* Inserting new key when oldValue is nil to KVCompareAndSet

* Updated error text to include CompareAndSet
Этот коммит содержится в:
Ali F
2019-04-23 13:35:17 -04:00
коммит произвёл Christopher Speller
родитель 446c6d452e
Коммит 6f8577b4c1
10 изменённых файлов: 311 добавлений и 0 удалений

Просмотреть файл

@@ -459,6 +459,16 @@ type API interface {
// KVSet will store a key-value pair, unique per plugin.
KVSet(key string, value []byte) *model.AppError
// KVCompareAndSet will update a key-value pair,
// unique per plugin, to the given new value if the current value == the old value.
// Inserts a new key if oldValue == nil.
// Returns (false, err) if DB error occurred
// Returns (false, nil) if current value != old value or key already exists when inserting
// Returns (true, nil) if current value == old value or new key is inserted
//
// Minimum server version: 5.12
KVCompareAndSet(key string, oldValue, newValue []byte) (bool, *model.AppError)
// KVSet will store a key-value pair, unique per plugin with an expiry time
//
// Minimum server version: 5.6