//////////////////////////////////////////////////////////////////////////////// // // Microsoft Research Singularity // // Copyright (c) Microsoft Corporation. All rights reserved. // // File: DirectoryServiceContract.sg // using Microsoft.SingSharp; using Microsoft.Singularity.Channels; namespace Microsoft.Singularity.Directory { public contract DirectoryServiceContract : ServiceContract { // ReadOnly part in message Bind(char[]! in ExHeap path, ServiceContract.Exp:Start! exp); out message AckBind(); out message NakBind(ServiceContract.Exp:Start exp); // return unconnected endpoint out message NakBindReparse( char[]! in ExHeap linkValue, ServiceContract.Exp:Start! exp); in message Notify(char[]! in ExHeap pathSpec, NotifyContract.Imp:Start! imp); out message AckNotify(); out message NakNotify(NotifyContract.Imp:Start! imp); // return unconnected endpoint out message NakNotifyReparse(char []! in ExHeap symlink, NotifyContract.Imp:Start! imp); // return unconnected endpoint in message Find(char[]! in ExHeap path, char[]! in ExHeap pattern); out message AckFind (FindResponse[]! in ExHeap results); out message NakFind(); // ReadWrite part in message Register(char[]! in ExHeap path, ServiceProviderContract.Imp:Start! imp); out message AckRegister(); out message NakRegister(ServiceProviderContract.Imp:Start imp); // return unconnected endpoint in message Deregister(char[]! in ExHeap path); out message AckDeregister(ServiceProviderContract.Imp:Start! imp); // return deregistered endpoint out message NakDeregister(); in message RegisterNameProvider(char[]! in ExHeap path, DirectoryServiceContract.Imp:Ready! imp); out message AckRegisterNameProvider(); out message NackRegisterNameProvider(DirectoryServiceContract.Imp:Ready! imp); // return unconnected endpoint in message DeregisterNameProvider(char[]! in ExHeap path); out message AckDeregisterNameProvider(DirectoryServiceContract.Imp:Ready! imp); // return deregistered endpoint out message NackDeregisterNameProvider(); // // FindFirst/FindNext: code= 0 more entries, 1 no more entries // in message FindFirst(char[]! in ExHeap prefix); out message AckFindFirst(char[] in ExHeap path, int code); out message NakFindFirst(); in message FindNext(char[]! in ExHeap prefix, char[]! in ExHeap previous); out message AckFindNext(char[] in ExHeap path, int code); out message NakFindNext(); out message Success(); override state Start: one { Success! -> Ready; } state Ready: one { Bind? -> ( AckBind! or NakBind! or NakBindReparse!) -> Ready; Find? -> ( AckFind! or NakFind! ) -> Ready; Notify? -> ( AckNotify! or NakNotify! or NakNotifyReparse! ) -> Ready; FindNext? -> ( AckFindNext! or NakFindNext! ) -> Ready; FindFirst? -> ( AckFindFirst! or NakFindFirst!) -> Ready; Register? -> ( AckRegister! or NakRegister! ) -> Ready; Deregister? -> ( AckDeregister! or NakDeregister! ) -> Ready; RegisterNameProvider? -> ( AckRegisterNameProvider! or NackRegisterNameProvider! ) -> Ready; DeregisterNameProvider? -> ( AckDeregisterNameProvider! or NackDeregisterNameProvider! ) -> Ready; } } }