/// <summary> /// Tries to read the value(s) under the given key. Used with types that implement /// <see cref="IHasVersionVector"/>. In case of conflict we return all conflicting versions. /// If the key is not found, returns an empty Multiple. /// </summary> public static Multiple <T> TryGetHasVec <T>(this IGossipBackend backend, string key) where T : IHasVersionVector { return(backend.TryGet(key, out Multiple <T> multi) ? multi : default);
/// <summary> /// Helper for types which implement <see cref="IHasVersionVector"/>, or are wrapped in a <see cref="VecVersioned{T}"/> /// wrapper. The value will be readable by <see cref="TryGetHasVec{T}(IGossipBackend, string)"/> or /// <see cref="VecVersionedExtensions.TryGetVecVersioned{T}(IGossipBackend, string)"/>, respectively. /// </summary> public static VectorRelationship SetHasVec <TItem>(this IGossipBackend backend, string key, TItem item, int?expireInMs = null) where TItem : IHasVersionVector { return(backend.Set(key, (Multiple <TItem>)item, expireInMs)); }
/// <summary> /// Tries to read the <see cref="Gossip.Lww{T}"/> value under the given key. If the key is not /// found, returns default. /// </summary> public static Lww <T> TryGetLww <T>(this IGossipBackend backend, string key) { return(backend.TryGet(key, out Lww <T> v) ? v : default);
/// <summary> /// Tries to read the <see cref="IntVersioned{T}"/> value under the given key. If the key is not /// found, returns default. /// </summary> public static IntVersioned <T> TryGetIntVersioned <T>(this IGossipBackend backend, string key) { return(backend.TryGet(key, out IntVersioned <T> v) ? v : default);
/// <summary> /// Tries to read the value(s) under the given key. Can be used with any type - wrapped /// in a <see cref="Gossip.VecVersioned{T}"/> to add a version vector. In case of conflict we return all /// conflicting versions. If the key is not found, returns an empty Multiple. /// </summary> public static Multiple <VecVersioned <T> > TryGetVecVersioned <T>(this IGossipBackend backend, string key) { return(backend.TryGet(key, out Multiple <VecVersioned <T> > multi) ? multi : default);