From Design It! From Programmer to Software Architect by Michael Keeling.
- Partition system and assign responsibilities.
- Decide trade-offs among quality attributes:
- Performance (response time)
- Scalability (annual growth)
- Availability
- Security
def wait_until(timeout \\ 1_000, fun) | |
def wait_until(0, fun), do: fun.() | |
def wait_until(timeout, fun) do | |
fun.() | |
rescue | |
ExUnit.AssertionError -> | |
:timer.sleep(10) |
const Hooks = { ViewportResizeHooks} | |
const connectLiveSocket = () => { | |
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute('content') | |
const liveSocket = new LiveSocket('/my_app/live', Socket, { | |
params: { | |
_csrf_token: csrfToken, | |
viewport: { | |
width: window.innerWidth, | |
height: window.innerHeight |
From Design It! From Programmer to Software Architect by Michael Keeling.
defmodule Projections.Repo.Migrations.CreateProjectionVersions do | |
use Ecto.Migration | |
def change do | |
create table(:projection_versions, primary_key: false) do | |
add :projection_name, :text, primary_key: true | |
add :last_seen_event_id, :bigint | |
timestamps | |
end |
defmodule UniqueUsername do | |
@behaviour Commanded.Middleware | |
alias Commanded.Middleware.Pipeline | |
def before_dispatch(%Pipeline{command: %RegisterUser{} = command} = pipeline) do | |
%RegisterUser{username: username} = command | |
case Repo.insert(%Username{username: username}) do | |
{:ok, _} -> |
docker pull postgres:12-alpine | |
docker run --rm \ | |
--name postgres10 \ | |
--tmpfs=/pgtmpfs \ | |
-e PGDATA=/pgtmpfs \ | |
-e POSTGRES_PASSWORD=postgres \ | |
-e POSTGRES_USER=postgres \ | |
-p 5432:5432 \ | |
postgres:10-alpine |
defmodule EventStore.CategoryStreamLinker do | |
@moduledoc """ | |
Links streams from aggregate instances to their respective category streams. | |
example: events from stream_uuid of `contractors_contract-07c52787-da0c-444f-9783-5d380f7093f9` will be | |
linked to stream_uuid of `contractors_contract`. | |
""" | |
use Commanded.Event.Handler, | |
application: My.App, |