本文整理汇总了C#中Nfs3FileHandle类的典型用法代码示例。如果您正苦于以下问题:C# Nfs3FileHandle类的具体用法?C# Nfs3FileHandle怎么用?C# Nfs3FileHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Nfs3FileHandle类属于命名空间,在下文中一共展示了Nfs3FileHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Nfs3FileStream
public Nfs3FileStream(Nfs3Client client, Nfs3FileHandle handle, FileAccess access)
{
_client = client;
_handle = handle;
_access = access;
_length = _client.GetAttributes(_handle).Size;
}
示例2: Nfs3MountResult
internal Nfs3MountResult(XdrDataReader reader)
{
FileHandle = new Nfs3FileHandle(reader);
int numAuthFlavours = reader.ReadInt32();
AuthFlavours = new List<int>(numAuthFlavours);
for (int i = 0; i < numAuthFlavours; ++i)
{
AuthFlavours.Add(reader.ReadInt32());
}
}
示例3: Nfs3Client
public Nfs3Client(string address, RpcCredentials credentials, string mountPoint)
{
_rpcClient = new RpcClient(address, credentials);
_mountClient = new Nfs3Mount(_rpcClient);
_rootHandle = _mountClient.Mount(mountPoint).FileHandle;
_nfsClient = new Nfs3(_rpcClient);
Nfs3FileSystemInfoResult fsiResult = _nfsClient.FileSystemInfo(_rootHandle);
_fsInfo = fsiResult.FileSystemInfo;
_cachedAttributes = new Dictionary<Nfs3FileHandle, Nfs3FileAttributes>();
_cachedAttributes[_rootHandle] = fsiResult.PostOpAttributes;
}
示例4: Nfs3DirectoryEntry
public Nfs3DirectoryEntry(XdrDataReader reader)
{
FileId = reader.ReadUInt64();
Name = reader.ReadString();
Cookie = reader.ReadUInt64();
if (reader.ReadBool())
{
FileAttributes = new Nfs3FileAttributes(reader);
}
if (reader.ReadBool())
{
FileHandle = new Nfs3FileHandle(reader);
}
}
示例5: Nfs3LookupResult
public Nfs3LookupResult(XdrDataReader reader)
{
Status = (Nfs3Status)reader.ReadInt32();
if (Status == Nfs3Status.Ok)
{
ObjectHandle = new Nfs3FileHandle(reader);
if (reader.ReadBool())
{
ObjectAttributes = new Nfs3FileAttributes(reader);
}
}
if (reader.ReadBool())
{
DirAttributes = new Nfs3FileAttributes(reader);
}
}
示例6: Nfs3CreateResult
public Nfs3CreateResult(XdrDataReader reader)
{
Status = (Nfs3Status)reader.ReadInt32();
if (Status == Nfs3Status.Ok)
{
if (reader.ReadBool())
{
FileHandle = new Nfs3FileHandle(reader);
}
if (reader.ReadBool())
{
FileAttributes = new Nfs3FileAttributes(reader);
}
}
CacheConsistency = new Nfs3WeakCacheConsistency(reader);
}
示例7: Access
public Nfs3AccessPermissions Access(Nfs3FileHandle handle, Nfs3AccessPermissions requested)
{
Nfs3AccessResult result = _nfsClient.Access(handle, requested);
if (result.ObjectAttributes != null)
{
_cachedAttributes[handle] = result.ObjectAttributes;
}
if (result.Status == Nfs3Status.Ok)
{
return result.Access;
}
else
{
throw new Nfs3Exception(result.Status);
}
}
示例8: GetAttributes
public Nfs3FileAttributes GetAttributes(Nfs3FileHandle handle)
{
Nfs3FileAttributes result;
if (_cachedAttributes.TryGetValue(handle, out result))
{
return result;
}
Nfs3GetAttributesResult getResult = _nfsClient.GetAttributes(handle);
if (getResult.Status == Nfs3Status.Ok)
{
_cachedAttributes[handle] = getResult.Attributes;
return getResult.Attributes;
}
else
{
throw new Nfs3Exception(getResult.Status);
}
}
示例9: Rename
public void Rename(Nfs3FileHandle fromDirHandle, string fromName, Nfs3FileHandle toDirHandle, string toName)
{
Nfs3RenameResult result = _nfsClient.Rename(fromDirHandle, fromName, toDirHandle, toName);
_cachedAttributes[fromDirHandle] = result.FromDirCacheConsistency.After;
_cachedAttributes[toDirHandle] = result.ToDirCacheConsistency.After;
if (result.Status != Nfs3Status.Ok)
{
throw new Nfs3Exception(result.Status);
}
}
示例10: RemoveDirectory
public void RemoveDirectory(Nfs3FileHandle dirHandle, string name)
{
Nfs3ModifyResult result = _nfsClient.RemoveDirectory(dirHandle, name);
_cachedAttributes[dirHandle] = result.CacheConsistency.After;
if (result.Status != Nfs3Status.Ok)
{
throw new Nfs3Exception(result.Status);
}
}
示例11: MakeDirectory
public Nfs3FileHandle MakeDirectory(Nfs3FileHandle dirHandle, string name, Nfs3SetAttributes attributes)
{
Nfs3CreateResult result = _nfsClient.MakeDirectory(dirHandle, name, attributes);
if (result.Status == Nfs3Status.Ok)
{
_cachedAttributes[result.FileHandle] = result.FileAttributes;
return result.FileHandle;
}
else
{
throw new Nfs3Exception(result.Status);
}
}
示例12: Write
public int Write(Nfs3FileHandle fileHandle, long position, byte[] buffer, int offset, int count)
{
Nfs3WriteResult result = _nfsClient.Write(fileHandle, position, buffer, offset, count);
_cachedAttributes[fileHandle] = result.CacheConsistency.After;
if (result.Status == Nfs3Status.Ok)
{
return result.Count;
}
else
{
throw new Nfs3Exception(result.Status);
}
}
示例13: Read
public Nfs3ReadResult Read(Nfs3FileHandle fileHandle, long position, int count)
{
Nfs3ReadResult result = _nfsClient.Read(fileHandle, position, count);
if (result.FileAttributes != null)
{
_cachedAttributes[fileHandle] = result.FileAttributes;
}
if (result.Status == Nfs3Status.Ok)
{
return result;
}
else
{
throw new Nfs3Exception(result.Status);
}
}
示例14: Lookup
public Nfs3FileHandle Lookup(Nfs3FileHandle dirHandle, string name)
{
Nfs3LookupResult result = _nfsClient.Lookup(dirHandle, name);
if (result.ObjectAttributes != null && result.ObjectHandle != null)
{
_cachedAttributes[result.ObjectHandle] = result.ObjectAttributes;
}
if (result.DirAttributes != null)
{
_cachedAttributes[dirHandle] = result.DirAttributes;
}
if (result.Status == Nfs3Status.Ok)
{
return result.ObjectHandle;
}
else if (result.Status == Nfs3Status.NoSuchEntity)
{
return null;
}
else
{
throw new Nfs3Exception(result.Status);
}
}
示例15: Write
public Nfs3WriteResult Write(Nfs3FileHandle handle, long position, byte[] buffer, int bufferOffset, int count)
{
MemoryStream ms = new MemoryStream();
XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, 7);
handle.Write(writer);
writer.Write(position);
writer.Write(count);
writer.Write((int)0); // UNSTABLE
writer.WriteBuffer(buffer, bufferOffset, count);
RpcReply reply = DoSend(ms);
if (reply.Header.IsSuccess)
{
return new Nfs3WriteResult(reply.BodyReader);
}
else
{
throw new RpcException(reply.Header.ReplyHeader);
}
}