forked from apache/reef
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
216 additions
and
49 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
lang/cs/Org.Apache.REEF.IO/BlockManagement/Block/BlockFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Org.Apache.REEF.Common.Attributes; | ||
|
||
namespace Org.Apache.REEF.IO.BlockManagement.Block | ||
{ | ||
[Unstable("0.14", "New feature. Interface can change substantially.")] | ||
internal sealed class BlockFactory | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
lang/cs/Org.Apache.REEF.IO/BlockManagement/Block/ReadonlyBlock.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you 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 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Org.Apache.REEF.Common.Attributes; | ||
using Org.Apache.REEF.IO.BlockManagement.Partition; | ||
|
||
namespace Org.Apache.REEF.IO.BlockManagement.Block | ||
{ | ||
/// <summary> | ||
/// A readonly implementation of <see cref="IBlock"/>. | ||
/// </summary> | ||
[Unstable("0.14", "New feature. Implementation can change substantially.")] | ||
public sealed class ReadonlyBlock : IBlock | ||
{ | ||
public Guid Uid { get; private set; } | ||
|
||
public IPartition Partition { get; private set; } | ||
|
||
public Location Location { get; private set; } | ||
|
||
public bool CanWrite | ||
{ | ||
get | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public IList<byte> Data | ||
{ | ||
get | ||
{ | ||
// TODO: Lazily fetch data into memory for consumption. | ||
// TODO: Register with BlockManager that there is local copy. | ||
// TODO: Return IReadOnlyList. | ||
Location = Location.InMemory; | ||
throw new NotImplementedException(); | ||
} | ||
|
||
set | ||
{ | ||
throw new NotSupportedException("Readable blocks are not set-able."); | ||
} | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
lang/cs/Org.Apache.REEF.IO/BlockManagement/Block/WritableBlock.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you 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 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Org.Apache.REEF.Common.Attributes; | ||
using Org.Apache.REEF.IO.BlockManagement.Partition; | ||
|
||
namespace Org.Apache.REEF.IO.BlockManagement.Block | ||
{ | ||
/// <summary> | ||
/// A block that can be written to. | ||
/// </summary> | ||
[Unstable("0.14", "New feature. Implementation can change substantially.")] | ||
public sealed class WritableBlock : IBlock | ||
{ | ||
internal WritableBlock(IPartition partition, Guid uid) | ||
{ | ||
Partition = partition; | ||
Uid = uid; | ||
CanWrite = true; | ||
Data = new List<byte>(); | ||
} | ||
|
||
public Guid Uid { get; private set; } | ||
|
||
public IPartition Partition { get; private set; } | ||
|
||
public Location Location | ||
{ | ||
get | ||
{ | ||
return Location.InMemory; | ||
} | ||
} | ||
|
||
public bool CanWrite { get; private set; } | ||
|
||
/// <summary> | ||
/// Data can only be mutated before commit. | ||
/// </summary> | ||
public IList<byte> Data { get; set; } | ||
|
||
/// <summary> | ||
/// Commits the block with the BlockManager and disables write on the WritableBlock. | ||
/// </summary> | ||
public ReadonlyBlock Commit() | ||
{ | ||
// TODO: Commit the block with the BlockManager and return a ReadonlyBlock if success. | ||
CanWrite = false; | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
lang/cs/Org.Apache.REEF.Utilities/IUniquelyIdentifiable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you 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 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
using System; | ||
|
||
namespace Org.Apache.REEF.Utilities | ||
{ | ||
/// <summary> | ||
/// Denotes an object that is globally, uniquely identifiable. | ||
/// </summary> | ||
public interface IUniquelyIdentifiable | ||
{ | ||
/// <summary> | ||
/// The unique ID of the object. | ||
/// </summary> | ||
Guid Uid { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters