diff options
Diffstat (limited to 'src/Service.hs')
-rw-r--r-- | src/Service.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Service.hs b/src/Service.hs index 4fc8335..a3a19a4 100644 --- a/src/Service.hs +++ b/src/Service.hs @@ -3,6 +3,7 @@ module Service ( SomeService(..), someService, someServiceAttr, someServiceID, SomeServiceState(..), fromServiceState, someServiceEmptyState, SomeServiceGlobalState(..), fromServiceGlobalState, someServiceEmptyGlobalState, + SomeStorageWatcher(..), ServiceID, mkServiceID, ServiceHandler, @@ -40,6 +41,9 @@ class (Typeable s, Storable s, Typeable (ServiceState s), Typeable (ServiceGloba serviceID :: proxy s -> ServiceID serviceHandler :: Stored s -> ServiceHandler s () + serviceNewPeer :: ServiceHandler s () + serviceNewPeer = return () + type ServiceAttributes s = attr | attr -> s type ServiceAttributes s = Proxy s defaultServiceAttributes :: proxy s -> ServiceAttributes s @@ -58,6 +62,9 @@ class (Typeable s, Storable s, Typeable (ServiceState s), Typeable (ServiceGloba default emptyServiceGlobalState :: ServiceGlobalState s ~ () => proxy s -> ServiceGlobalState s emptyServiceGlobalState _ = () + serviceStorageWatchers :: proxy s -> [SomeStorageWatcher s] + serviceStorageWatchers _ = [] + data SomeService = forall s. Service s => SomeService (Proxy s) (ServiceAttributes s) @@ -87,6 +94,9 @@ someServiceEmptyGlobalState :: SomeService -> SomeServiceGlobalState someServiceEmptyGlobalState (SomeService p _) = SomeServiceGlobalState p (emptyServiceGlobalState p) +data SomeStorageWatcher s = forall a. Eq a => SomeStorageWatcher (Stored LocalState -> a) (a -> ServiceHandler s ()) + + newtype ServiceID = ServiceID UUID deriving (Eq, Ord, StorableUUID) |