Skip to content

Instantly share code, notes, and snippets.

Robert Friberg rofr

Block or report user

Report or block rofr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View registry.cs
public class MyRegistry : Registry
{
public PosifonIntegrationServicesRegistry()
{
For<DateTimeProvider>().Use(() => DateTimeProvider.Default);
For<DeviceMessageHandler>().Use<DeviceMessageHandler>();
var connectionString = ConfigurationManager
.ConnectionStrings["redacted"]
@rofr
rofr / eventAggregation.cs
Created Mar 22, 2019
Event Aggregator DP example
View eventAggregation.cs
interface IMessageSource
{
event MessageHandler MessagePublished;
}
public delegate void MessageHandler(string message);
class MessageAggregator
{
public event MessageHandler MessagePublished;
View FSQ Privacy Policy
<!DOCTYPE html>
<html><head></head>
<body><h1>Privacy Policy for FSQ</h1>
<p>At FSQ Forum, accessible from https://forum.fsq.se, one of our main priorities is the privacy of our visitors. This Privacy Policy document contains types of information that is collected and recorded by FSQ Forum and how we use it.</p>
<p>If you have additional questions or require more information about our Privacy Policy, do not hesitate to contact us through email at robert@devrex.se</p>
<h2>General Data Protection Regulation (GDPR)</h2>
<p>We are a Data Controller of your information.</p>
@rofr
rofr / tutorial.md
Last active Apr 20, 2018
Memstate tutorial proposal
View tutorial.md

Workshop - Memstate tutorial

In this coding intensive workshop we will build an asp.net core mvc application using a memstate backend. Focus will be on memstate specifics such as domain modeling, testing, configuration and integrating with the web application. Bring your Linux, Mac or Windows laptop and code along or sit back and enjoy the ride as Robert talks you through. The materials will be available online so you can continue later at your own pace.

Memstate introduces a radically different approach to managing state. Traditional applications pull in some data from the database, translate to internal types and structures, manipulate, translate back and save any changes made to the database. In a memstate application the data and code exist together in the same process all defined in whatever high-level .NET language you prefer. The memstate runtime will provide transparent persistence and strong consistency guarantees and lets you focus on what matters most.

Contents

  • Introduction - A quick i
@rofr
rofr / movieGraphModel.cs
Created Dec 1, 2017
Memstate movie model - strongly typed graphs
View movieGraphModel.cs
//define actor node type
class Actor {
String Name;
Set<Role> Movies;
}
//define movie node type
class Movie {
String Name;
Set<Role> Roles;
@rofr
rofr / memstate-graph-example.cs
Created Dec 1, 2017
Memstate models are strongly typed object graphs
View memstate-graph-example.cs
//user defined model with collections of user defined entities
class MyGraph {
Dictionary<Guid,Customer> Customers;
Dictionary<Guid,Order> Orders;
Dictionary<Guid,Product> Products;
}
class Order {
Customer Customer;
List<OrderLine> Lines;
@rofr
rofr / funkyProduct.js
Last active Nov 29, 2017
Recursive implementation of silly FB challenge
View funkyProduct.js
function funkyProduct(list, leftProduct = 1) {
if (list.length === 0) return [1];
else {
var result = funkyProduct(list.slice(1), leftProduct * list[0]);
var rightProduct = result[0] * list[0];
result[0] *= leftProduct;
if (leftProduct > 1) result.unshift(rightProduct);
return result;
}
}
@rofr
rofr / MemstateBenchmarks.cs
Last active Nov 6, 2017
Failing benchmarkdotnet benchmarks for memstate
View MemstateBenchmarks.cs
namespace Memstate.Benchmarks
{
using System;
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
View keybase.md

Keybase proof

I hereby claim:

  • I am rofr on github.
  • I am rofr (https://keybase.io/rofr) on keybase.
  • I have a public key ASAWCZS4EE6xRnrKxwT2RO80c-wpEuIGVQBLJ07eL-NapAo

To claim this, I am signing this object:

@rofr
rofr / piggyback-consensus.md
Created Oct 3, 2017
Thoughts on CAP, consensus and replication in a memstate cluster
View piggyback-consensus.md

OrigoDB

OrigoDB Server is an in-memory database for dotnet written in c#. It's implemented as a replicated state machine using write ahead logging of the mutating operations. The in-memory state model is derived from the sequence of operations persisted to the log. Writes are only accepted by the primary node and syncronously replicated to each of the replica nodes.  OrigoDB has no leader election (because the effort would be massive), promotion to primary is a manual process. https://github.com/devrexlabs/origodb

Memstate

Memstate is a reimplementation/port of OrigoDB based on the same principles but with a fundamentally different approach to logging. By routing the mutating operations (commands) through an underlying stream database (eventstore, kafka, kinesis, etc) message ordering, distribution and durability are guaranteed at the logging level. The key is to apply the commands when they return from the stream database. Using this model it's possible to accept writes at any node. This is the curren

You can’t perform that action at this time.