Dryad/GraphManager/filesystem/DrPartitionFile.h

74 lines
2.6 KiB
C++

/*
Copyright (c) Microsoft Corporation
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License
at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF
TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions and
limitations under the License.
*/
#pragma once
DRCLASS(DrPartitionInputStream) : public DrInputStream
{
public:
HRESULT Open(DrUniversePtr universe, DrNativeString streamName);
HRESULT OpenInternal(DrUniversePtr universe, DrString streamName);
virtual DrString GetStreamName() DROVERRIDE;
virtual int GetNumberOfPartitions() DROVERRIDE;
virtual DrAffinityRef GetAffinity(int partitionIndex) DROVERRIDE;
virtual DrString GetURIForRead(int partitionIndex, DrResourcePtr runningResource) DROVERRIDE;
typedef DrStringStringDictionary Override;
DRREF(Override);
typedef DrArray<OverrideRef> OverrideArray;
DRAREF(OverrideArray,OverrideRef);
private:
DrString m_streamName;
DrString m_pathNameOnComputer;
DrAffinityArrayRef m_affinity;
DrStringArrayRef m_remoteName;
OverrideArrayRef m_override;
};
DRREF(DrPartitionInputStream);
DRCLASS(DrPartitionOutputStream) : public DrOutputStream
{
public:
HRESULT Open(DrNativeString streamName, DrNativeString pathBase);
HRESULT OpenInternal(DrString streamName, DrString pathBase);
virtual void SetNumberOfPartitions(int numberOfPartitions) DROVERRIDE;
virtual DrString GetURIForWrite(int partitionIndex, int id, int version, int outputPort,
DrResourcePtr runningResource,
DrMetaDataRef metaData) DROVERRIDE;
virtual void DiscardUnusedPartition(int partitionIndex, int id, int version, int outputPort,
DrResourcePtr runningResource) DROVERRIDE;
virtual HRESULT FinalizeSuccessfulPartitions(DrOutputPartitionArrayRef partitionArray) DROVERRIDE;
virtual void ExtendLease(DrTimeInterval) DROVERRIDE;
private:
HRESULT RenameSuccessfulPartition(int partitionIndex, DrOutputPartition p);
DrString m_streamName;
DrString m_pathBase;
DrOutputPartitionArrayRef m_successfulPartitions;
};
DRREF(DrPartitionOutputStream);