singrdk/base/Contracts/NameSpace.Contracts/Directory.sg

123 lines
5.5 KiB
Plaintext

///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
using System;
using Microsoft.SingSharp;
using Microsoft.Singularity.Channels;
using Microsoft.Singularity.Directory;
namespace Microsoft.Singularity.Directory {
contract DirectoryServiceContract : ServiceContract {
// Flag values (used in AckAttributes)
public enum FileFlags
{
File = 128,
SymLink = 64,
Directory = 16,
Hidden = 2, //will we ever support this?
ReadOnly = 1, //will we ever support this?
}
out message Success();
////////////////////////////////////////////////////////
// Directory-related messages
////////////////////////////////////////////////////////
in message CreateDirectory(char []! in ExHeap dirName);
out message AckCreateDirectory();
out message NakCreateDirectory(ErrorCode code);
in message CreateAndBindDirectory(char []! in ExHeap dirName, DirectoryServiceContract.Imp:Ready! imp);
out message AckCreateAndBindDirectory();
out message NakCreateAndBindDirectory(ErrorCode code,DirectoryServiceContract.Imp:Ready imp);
in message BindDirectory(char []! in ExHeap dirName, DirectoryServiceContract.Imp:Ready! imp);
out message AckBindDirectory();
out message NakBindDirectory(ErrorCode code,DirectoryServiceContract.Imp:Ready imp);
in message DeleteDirectory(char []! in ExHeap dirName);
out message AckDeleteDirectory();
out message NakDeleteDirectory(ErrorCode code);
////////////////////////////////////////////////////////
// File-related messages
////////////////////////////////////////////////////////
in message CreateFile(char []! in ExHeap fileName);
out message AckCreateFile();
out message NakCreateFile(ErrorCode code);
in message CreateAndBindFile(char []! in ExHeap fileName, FileContract.Imp:Ready! imp);
out message AckCreateAndBindFile();
out message NakCreateAndBindFile(ErrorCode code,FileContract.Imp:Ready imp);
in message BindFile(char []! in ExHeap fileName, FileContract.Imp:Ready! imp);
out message AckBindFile();
out message NakBindFile(ErrorCode code,FileContract.Imp:Ready imp);
in message DeleteFile(char []! in ExHeap fileName);
out message AckDeleteFile();
out message NakDeleteFile(ErrorCode code);
in message Attributes(char []! in ExHeap fileName);
out message AckAttributes(long size, uint flags, long linkFlags);
out message NakFileAttributes(ErrorCode code);
////////////////////////////////////////////////////////
// Security-related messages
////////////////////////////////////////////////////////
in message QueryACL(char []! in ExHeap fileName,
byte[]! in ExHeap permission);
out message AckQueryACL(byte[]! in ExHeap acl);
out message NakQueryACL(ErrorCode code);
in message StoreACL(char []! in ExHeap fileName,
byte[]! in ExHeap permission,
byte[]! in ExHeap acl);
out message AckStoreACL();
out message NakStoreACL(ErrorCode code);
////////////////////////////////////////////////////////
// SymbolicLink-related messages
////////////////////////////////////////////////////////
in message CreateLink(char []! in ExHeap linkPath, char []! in ExHeap linkValue );
out message AckCreateLink();
out message NakCreateLink(ErrorCode code);
in message DeleteLink(char []! in ExHeap linkPath);
out message AckDeleteLink();
out message NakDeleteLink(ErrorCode code);
in message Close();
out message AckClose();
override state Start: one {
Success! -> Ready;
}
state Ready: one {
CreateDirectory? -> (AckCreateDirectory! or NakCreateDirectory!) -> Ready;
CreateAndBindDirectory? -> (AckCreateAndBindDirectory! or NakCreateAndBindDirectory!) -> Ready;
BindDirectory? -> (AckBindDirectory! or NakBindDirectory!) -> Ready;
DeleteDirectory? -> (AckDeleteDirectory! or NakDeleteDirectory!) -> Ready;
CreateFile? -> (AckCreateFile! or NakCreateFile!) -> Ready;
CreateAndBindFile? -> (AckCreateAndBindFile! or NakCreateAndBindFile!) -> Ready;
BindFile? -> (AckBindFile! or NakBindFile!) -> Ready;
DeleteFile? -> (AckDeleteFile! or NakDeleteFile!) -> Ready;
Attributes? -> (AckAttributes! or NakFileAttributes!) -> Ready;
QueryACL? -> (AckQueryACL! or NakQueryACL!) -> Ready;
StoreACL? -> (AckStoreACL! or NakStoreACL!) -> Ready;
CreateLink? -> (AckCreateLink! or NakCreateLink!) -> Ready;
DeleteLink? -> (AckDeleteLink! or NakDeleteLink!) -> Ready;
Close? -> AckClose! -> Ready;
}
}
}