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
rofr@DELLCRAPPO /c/git/scriptcs/origo1 | |
$ scriptcs | |
scriptcs (ctrl-c to exit) | |
> using OrigoDB.Core; | |
> #r Todo.Core.dll | |
> using Todo.Core; | |
> var engine = Engine.Load<TodoModel>(); | |
> using OrigoDB.Core.Proxy; | |
> var db = engine.GetProxy(); |
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
/// <summary> | |
/// A Kernel that handles immutable models and commands using lock free mvcc | |
/// </summary> | |
public class ImmutabilityKernel : OptimisticKernel | |
{ | |
public ImmutabilityKernel(EngineConfiguration config, Model model) : | |
base(config, model) | |
{ | |
} |
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
[Test] | |
public void Timestamp_is_transfered_to_journalentry() | |
{ | |
JournalEntry entry = null; | |
var fake = A.Fake<IJournalWriter>(); | |
A.CallTo(() => fake.Write(A<JournalEntry>._)) | |
.Invokes((JournalEntry je) => | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using OrigoDB.Core; | |
using OrigoDB.Core.Proxy; | |
public class RedisModel : Model | |
{ |
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
/// <summary> | |
/// Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high. | |
/// The rank (or index) is 0-based, which means that the member with the lowest score has rank 0. | |
/// </summary> | |
/// <param name="key"></param> | |
/// <param name="member"></param> | |
/// <returns>the rank of member or null if the set or member does not exist</returns> | |
public int? ZRank(string key, string member) | |
{ | |
SortedSet<ZSetEntry> set = GetSortedSet(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
C:\git\scriptcs>scriptcs | |
scriptcs (ctrl-c to exit) | |
> #r C:\git\Origo\OrigoDB.Modules\Protobuf\OrigoDB.Modules.Protobuf\bin\Release\origodb.modules.protobuf.dll | |
> #r C:\git\Origo\OrigoDB.Modules\Protobuf\OrigoDB.Modules.Protobuf\bin\Release\protobuf-net.dll | |
> #r C:\git\GeekStream\src\GeekStream.Core\bin\Release\geekstream.core.dll | |
> using GeekStream.Core.Commands; | |
> using GeekStream.Core.Domain; | |
> typeof(AddFeedItemCommand) | |
"GeekStream.Core.Commands.AddFeedItemCommand, GeekStream.Core, Version=1.0.0.0,Culture=neutral, PublicKeyToken=null" |
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
[Serializable] | |
public class DocumentModel : Model | |
{ | |
private readonly Dictionary<object,object> _documents; | |
public DocumentModel() | |
{ | |
_documents = new Dictionary<object, object>(); | |
} | |
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
[Serializable] | |
public class PutCommand : Command<DocumentModel> | |
{ | |
public readonly object Key; | |
public readonly object Document; | |
public PutCommand(object key, object document) | |
{ | |
Key = key; | |
Document = document; |
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
public class DocumentDatabaseEngine | |
{ | |
private readonly Engine<DocumentModel> _engine; | |
public DocumentDatabaseEngine(string location) | |
{ | |
_engine = Engine.LoadOrCreate<DocumentModel>(location); | |
} | |
public DocumentDatabaseEngine() : this(String.Empty) |
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
public class Program | |
{ | |
public static int CountCustomersQuery(Dictionary<object,object> docs) | |
{ | |
return docs.OfType<Customer>().Count(); | |
} | |
public static void Main(string[] args) | |
{ | |
//Loads or creates a new database at the default location |