Skip to content

Commit

Permalink
Merge pull request #28 from rbeauchamp-lendingtree/feature/4
Browse files Browse the repository at this point in the history
#4: Provide async implementation of API
  • Loading branch information
rexm committed Apr 13, 2014
2 parents b660afb + 17ad51b commit 3c1bbc0
Show file tree
Hide file tree
Showing 167 changed files with 11,604 additions and 243 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ before_script:
- 'if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then bash build/SetupSSH.sh; fi'
- 'if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then bash build/GitSetup.sh; fi'
- 'source build/SetBuildNumber.sh'
- 'if [[ $TRAVIS_BRANCH == "master" ]]; then source build/PushBuildNumber.sh; fi'
- 'if [[ $TRAVIS_PULL_REQUEST == "false" && $TRAVIS_BRANCH == "master" ]]; then source build/PushBuildNumber.sh; fi'
- 'bash build/SetAssemblyVersion.sh'

install:
Expand Down
Binary file modified Cucumber.SimpleDb.dll
100755 → 100644
Binary file not shown.
15 changes: 15 additions & 0 deletions MicrosoftOpenTechnologiesLicense.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
Microsoft Open Technologies would like to thank its contributors, a list of whom
are at http://aspnetwebstack.codeplex.com/wikipage?title=Contributors.

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

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.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SimpleDb.NET [![Build Status](https://travis-ci.org/rexm/SimpleDb.Net.png?branch=master)](https://travis-ci.org/rexm/SimpleDb.Net)
# SimpleDb.NET [![Build Status](https://travis-ci.org/rexm/SimpleDb.Net.svg?branch=master)](https://travis-ci.org/rexm/SimpleDb.Net)

A .NET library that lets you work with [AWS SimpleDB][1] using a familiar entity-like model and LINQ queries.

Expand Down Expand Up @@ -58,9 +58,11 @@ simpleDb.SubmitChanges();

Creating and deleting Domains are executed immediately.

You can find more details on the [wiki](https://github.com/rexm/SimpleDb.Net/wiki).

## Contributing

Use GitHub pull requests to point to code changes. For very large changes, open an issue first to explain the shortcomings you intend to address.
Check out the [contribution guidelines on the wiki](https://github.com/rexm/SimpleDb.Net/wiki/About-the-Project#how-to-contribute).

## Acknowledgements

Expand Down
2 changes: 1 addition & 1 deletion build/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.4
2.2.9
8 changes: 8 additions & 0 deletions source/Cucumber.SimpleDb.Async/Async/IInternalContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Cucumber.SimpleDb.Async
{
internal interface IInternalContext
{
ISimpleDbService Service { get; }
ISession Session { get; }
}
}
18 changes: 18 additions & 0 deletions source/Cucumber.SimpleDb.Async/Async/ISimpleDbAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Cucumber.SimpleDb.Async
{
/// <summary>
/// Represents a single attribute on a <c>Cucumber.SimpleDb.ISimpleDbItem</c> instance
/// </summary>
public interface ISimpleDbAttribute
{
/// <summary>
/// Gets and sets the value of the attribute
/// </summary>
SimpleDbAttributeValue Value { get; set; }

/// <summary>
/// Gets the name of the attribute
/// </summary>
string Name { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.Generic;

namespace Cucumber.SimpleDb.Async
{
/// <summary>
/// Represents the collection of <c>Cucumber.SimpleDb.ISimpleDbAttribute</c> instances on a <c>Cucumber.SimpleDb.ISimpleDbItem</c> instance
/// </summary>
public interface ISimpleDbAttributeCollection : IEnumerable<ISimpleDbAttribute>
{
/// <summary>
/// Gets the attribute of the specified name.
/// </summary>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown when the collection does not contain an attribute with a matching name</exception>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="attributeName"/> is null or empty</exception>
/// <param name="attributeName">The name of the attribute</param>
/// <returns>The requested attribute</returns>
ISimpleDbAttribute this[string attributeName] { get; }

/// <summary>
/// Gets whether the collection contains an attribute with the speified name
/// </summary>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="attributeName"/> is null or empty</exception>
/// <param name="attributeName">The name of the attribute to search for</param>
/// <returns>True if an attribute with the specified name exists; otherwise false</returns>
bool HasAttribute(string attributeName);

/// <summary>
/// Adds an attribute to the collection.
/// <para>If the collection already contains an attribute with the same name, that attribute is overwritten</para>
/// </summary>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="attributeName"/> or <paramref name="value"/> is null or empty</exception>
/// <param name="attributeName">The name of the attribute</param>
/// <param name="value">The initial value of the attribute</param>
void Add(string attributeName, SimpleDbAttributeValue value);
}
}
20 changes: 20 additions & 0 deletions source/Cucumber.SimpleDb.Async/Async/ISimpleDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

namespace Cucumber.SimpleDb.Async
{
/// <summary>
/// Represents the main entry point for SimpleDb.NET
/// </summary>
public interface ISimpleDbContext : IDisposable
{
/// <summary>
/// Gets the collection of domains residing in this SimpleDb instance.
/// </summary>
ISimpleDbDomainCollection Domains { get; }

/// <summary>
/// Computes the set of modified objects to be inserted, updated, or deleted, and executes the appropriate commands to implement the changes to SimpleDb.
/// </summary>
void SubmitChanges();
}
}
48 changes: 48 additions & 0 deletions source/Cucumber.SimpleDb.Async/Async/ISimpleDbDomain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace Cucumber.SimpleDb.Async
{
/// <summary>
/// Represents a single domain instance in SimpleDb.
/// </summary>
public interface ISimpleDbDomain
{
/// <summary>
/// Gets the collection of items present in the current domain.
/// </summary>
ISimpleDbItemCollection Items { get; }

/// <summary>
/// Gets the name of the domain.
/// </summary>
string Name { get; }

/// <summary>
/// Gets the total number of attribute names present in the current domain.
/// </summary>
long AttributeNameCount { get; }

/// <summary>
/// Gets the total number of attribute values present in the current domain.
/// </summary>
long AttributeValueCount { get; }

/// <summary>
/// Gets the total size (in bytes) of the item names in the current domain.
/// </summary>
long TotalItemNameSize { get; }

/// <summary>
/// Gets the total size (in bytes) of the attribute values in the current domain.
/// </summary>
long TotalAttributeValueSize { get; }

/// <summary>
/// Gets the total size (in bytes) of the attribute names in the current domain.
/// </summary>
long TotalAttributeNameSize { get; }

/// <summary>
/// Deletes the current domain and all its data.
/// </summary>
void Delete();
}
}
41 changes: 41 additions & 0 deletions source/Cucumber.SimpleDb.Async/Async/ISimpleDbDomainCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Collections.Generic;

namespace Cucumber.SimpleDb.Async
{
/// <summary>
/// Represents a collection of <c>Cucumber.SimpleDb.ISimpleDbDomain</c> instances
/// </summary>
public interface ISimpleDbDomainCollection : IEnumerable<ISimpleDbDomain>
{
/// <summary>
/// Gets the total number of domains in the collection.
/// </summary>
int Count { get; }

/// <summary>
/// Gets the domain of the specified name.
/// </summary>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown when the collection does not contain an domain with a matching name</exception>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="name"/> is null or empty</exception>
/// <param name="name">The name of the domain</param>
/// <returns>The requested domain</returns>
ISimpleDbDomain this[string name] { get; }

/// <summary>
/// Creates a domain with the specified name.
/// <para>If a domain with the same name already exists, no domain is created and the existing domain is returned.</para>
/// </summary>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="name"/> is null or empty</exception>
/// <param name="name">The name of the domain to create</param>
/// <returns>The new domain if no matching domain existed, otherwise the existing domain</returns>
ISimpleDbDomain Add(string name);

/// <summary>
/// Gets whether a domain with the speified name exists
/// </summary>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="name"/> is null or empty</exception>
/// <param name="name">The name of the domain to search for</param>
/// <returns>True if a domain with the specified name exists; otherwise false</returns>
bool HasDomain(string name);
}
}
40 changes: 40 additions & 0 deletions source/Cucumber.SimpleDb.Async/Async/ISimpleDbItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace Cucumber.SimpleDb.Async
{
/// <summary>
/// Represents a single instance of a SimpleDb item.
/// </summary>
public interface ISimpleDbItem
{
/// <summary>
/// Gets the name of the item.
/// </summary>
string Name { get; }

/// <summary>
/// Gets the collection of attributes present on the current item.
/// </summary>
ISimpleDbAttributeCollection Attributes { get; }

/// <summary>
/// Gets and sets the value of the specified attribute.
/// <para>If the value of a non-existent attribute is requested, null will be returned.</para>
/// <para>If a value is set for a non-existent attribute, the attribute will be created with the specified name.</para>
/// </summary>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="attributeName"/> is null or empty</exception>
/// <param name="attributeName">The name of the attribute</param>
/// <returns>The value of the attribute if it exists; otherwise null.</returns>
SimpleDbAttributeValue this[string attributeName] { get; set; }

/// <summary>
/// Marks the current instance for deletion when <c>Cucumber.SimpleDb.ISimpleDbContext.SubmitChanges()</c> is invoked.
/// </summary>
void Delete();

/// <summary>
/// Marks the current instance for conditional deletion when <c>Cucumber.SimpleDb.ISimpleDbContext.SubmitChanges()</c> is invoked.
/// </summary>
/// <param name="expectedAttribute">The name of the attribute to verify before deleting.</param>
/// <param name="expectedValue">The expected value of the attribute (or null if only existence should be verified).</param>
void DeleteWhen(string expectedAttribute, SimpleDbAttributeValue expectedValue);
}
}
69 changes: 69 additions & 0 deletions source/Cucumber.SimpleDb.Async/Async/ISimpleDbItemCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System.Collections.Generic;
using System.Linq;

namespace Cucumber.SimpleDb.Async
{
/// <summary>
/// Represents a collection of <c>Cucumber.SimpleDb.ISimpleDbItem</c> instances in a <c>Cucumber.SimpleDb.ISimpleDbDomain</c>.
/// </summary>
public interface ISimpleDbItemCollection : IQueryable<ISimpleDbItem>
{
/// <summary>
/// Gets the item with the specified name.
/// <para>If no item with the specified name exists, null will be returned.</para>
/// </summary>
/// <param name="itemName">The name of the item to return.</param>
/// <returns>The <c>Cucumber.SimpleDb.ISimpleDbItem</c> instance if exists; otherwise null.</returns>
ISimpleDbItem this[string itemName] { get; }

/// <summary>
/// Gets the total number of items in the collection.
/// </summary>
int Count { get; }

/// <summary>
/// Gets the parent domain.
/// </summary>
ISimpleDbDomain Domain { get; }

/// <summary>
/// Creates a new item.
/// </summary>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="name"/> is null or empty</exception>
/// <param name="name">The name of the item to create.</param>
/// <returns>The new item.</returns>
ISimpleDbItem Add(string name);

/// <summary>
/// Creates a new item with the specified initial attributes
/// </summary>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="name"/> is null or empty</exception>
/// <param name="name">The name of the item to create.</param>
/// <param name="values">A collection of name-value pairs to initialize the <c>Cucumber.SimpleDb.ISimpleDbItem.Attributes</c> collection.</param>
/// <returns>The new item.</returns>
ISimpleDbItem Add(string name, Dictionary<string, SimpleDbAttributeValue> values);

/// <summary>
/// Creates a new item with the specified initial attributes and associated commit condition.
/// <para>A new <c>Cucumber.SimpleDb.ISimpleDbItem</c> instance will be created, but when <c>Cucumber.SimpleDb.ISimpleDbContext.SubmitChanges()</c> is invoked, the item will only be committed to SimpleDb if the condition evaluates true.</para>
/// </summary>
/// <see cref="Cucumber.SimpleDb.ISimpleDbContext"/>
/// <param name="name">The name of the item to create.</param>
/// <param name="values">A collection of name-value pairs to initialize the <c>Cucumber.SimpleDb.ISimpleDbItem.Attribtues</c> collection.</param>
/// <param name="conditionAttribute">The name of the conditional attribute to check.</param>
/// <param name="conditionValue">The expected value of the conditional attribute.</param>
/// <returns>The new item.</returns>
ISimpleDbItem AddWhen(string name, Dictionary<string, SimpleDbAttributeValue> values, string conditionAttribute, SimpleDbAttributeValue conditionValue);

/// <summary>
/// Creates a new item with the associated commit condition.
/// <para>A new <c>Cucumber.SimpleDb.ISimpleDbItem</c> instance will be created, but when <c>Cucumber.SimpleDb.ISimpleDbContext.SubmitChanges()</c> is invoked, the item will only be committed to SimpleDb if the condition evaluates true.</para>
/// </summary>
/// <see cref="Cucumber.SimpleDb.ISimpleDbContext"/>
/// <param name="name">The name of the item to create.</param>
/// <param name="conditionAttribute">The name of the conditional attribute to check.</param>
/// <param name="conditionValue">The expected value of the conditional attribute.</param>
/// <returns>The new item.</returns>
ISimpleDbItem AddWhen(string name, string conditionAttribute, SimpleDbAttributeValue conditionValue);
}
}
Loading

0 comments on commit 3c1bbc0

Please sign in to comment.