This commit is contained in:
Dmitry Zuikov 2024-03-12 11:44:15 +03:00
parent f96621b612
commit e71d5403fc
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1 @@
module RPC2.LWWRef where

View File

@ -164,6 +164,7 @@ library
HBS2.Peer.RPC.API.Peer HBS2.Peer.RPC.API.Peer
HBS2.Peer.RPC.API.RefLog HBS2.Peer.RPC.API.RefLog
HBS2.Peer.RPC.API.RefChan HBS2.Peer.RPC.API.RefChan
HBS2.Peer.RPC.API.LWWRef
HBS2.Peer.RPC.API.Storage HBS2.Peer.RPC.API.Storage
HBS2.Peer.RPC.Client.Unix HBS2.Peer.RPC.Client.Unix
HBS2.Peer.RPC.Client.StorageClient HBS2.Peer.RPC.Client.StorageClient
@ -257,6 +258,7 @@ executable hbs2-peer
, RPC2.Downloads , RPC2.Downloads
, RPC2.RefLog , RPC2.RefLog
, RPC2.RefChan , RPC2.RefChan
, RPC2.LWWRef
, PeerTypes , PeerTypes
, PeerLogger , PeerLogger
, PeerConfig , PeerConfig

View File

@ -0,0 +1,35 @@
module HBS2.Peer.RPC.API.LWWRef where
import HBS2.Peer.Prelude
import HBS2.Peer.Proto.LWWRef
import HBS2.Data.Types.SignedBox
import HBS2.Net.Messaging.Unix
import HBS2.Data.Types.Refs (HashRef(..))
import HBS2.Net.Proto.Service
import HBS2.Peer.Proto.RefLog (RefLogUpdate)
import Data.ByteString.Lazy (ByteString)
import Codec.Serialise
data LWWRefGet
data LWWRefUpdate
type LWWRefAPI = '[ LWWRefGet -- may be done via storage
, LWWRefUpdate --
]
instance HasProtocol UNIX (ServiceProto LWWRefAPI UNIX) where
type instance ProtocolId (ServiceProto LWWRefAPI UNIX) = 16267229472009458342
type instance Encoded UNIX = ByteString
decode = either (const Nothing) Just . deserialiseOrFail
encode = serialise
type instance Input LWWRefGet = LWWRefKey HBS2Basic
type instance Output LWWRefGet = Maybe (LWWRef L4Proto)
type instance Input LWWRefUpdate = SignedBox (LWWRef L4Proto) L4Proto
type instance Output LWWRefUpdate = ()