returns [result, change, error]
(incoming Mergeable, incomingValueRequiresClone bool, oldVal Mergeable, cas bool)
| 1821 | |
| 1822 | // returns [result, change, error] |
| 1823 | func computeNewValue(incoming Mergeable, incomingValueRequiresClone bool, oldVal Mergeable, cas bool) (Mergeable, Mergeable, error) { |
| 1824 | if oldVal == nil { |
| 1825 | // It's OK to return the same value twice (once as result, once as change), because "change" will be cloned |
| 1826 | // in mergeValueForKey if needed. |
| 1827 | |
| 1828 | if incomingValueRequiresClone { |
| 1829 | clone := incoming.Clone() |
| 1830 | return clone, clone, nil |
| 1831 | } |
| 1832 | |
| 1833 | return incoming, incoming, nil |
| 1834 | } |
| 1835 | |
| 1836 | // otherwise we have two mergeables, so merge them |
| 1837 | change, err := oldVal.Merge(incoming, cas) |
| 1838 | return oldVal, change, err |
| 1839 | } |
| 1840 | |
| 1841 | func (m *KV) storeCopy() map[string]ValueDesc { |
| 1842 | m.storeMu.Lock() |
no test coverage detected