Re: [dispatch] A State Synchronization Working Group

Michael Toomim <toomim@gmail.com> Mon, 30 October 2023 23:52 UTC

Return-Path: <toomim@gmail.com>
X-Original-To: dispatch@ietfa.amsl.com
Delivered-To: dispatch@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7CCE7C15109F for <dispatch@ietfa.amsl.com>; Mon, 30 Oct 2023 16:52:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.195
X-Spam-Level:
X-Spam-Status: No, score=-2.195 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.091, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LQmMj5Nrtm_B for <dispatch@ietfa.amsl.com>; Mon, 30 Oct 2023 16:52:39 -0700 (PDT)
Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 92168C15106F for <dispatch@ietf.org>; Mon, 30 Oct 2023 16:52:39 -0700 (PDT)
Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1cc316ccc38so14884905ad.1 for <dispatch@ietf.org>; Mon, 30 Oct 2023 16:52:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698709959; x=1699314759; darn=ietf.org; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=9wlWaBu6wgd+qsf70eH0liQoYl6w3ofG58Sva8u069I=; b=Hi8NsJ+rby4yqQp39WH8z6N/frN+I9eaiHQWfM+v5AyF+iiW53ZBSMHg00bhdXHseQ 8N8uUjiKCmDYq/prl3FEGQHadaRgEMnHXMV54UTgahqJQZYmCR4Bj/lHxR5bRpDKxt2T WtnebmjSQ5vZgbWNWdU254M9jMLg2a+n10o2r6EC69WsGZNAK2q029PZLXjBn0MVsIqJ GrxQfh7L8joOhoTWBelNcIcd/0RQ2LYrDz17WEMmxMUlbXuX0iwPb2mf4PcDzuXzjfax PZuZJOUlqFZGvH2ggyUoP/VFVgB+zyA6POA6H2deCOWihF6OBS24ozdQsKGRfGpDSjSt ktVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698709959; x=1699314759; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9wlWaBu6wgd+qsf70eH0liQoYl6w3ofG58Sva8u069I=; b=qbdfHUCOWVbN+tsP27nL2yLNO8ErSudlo0nLEGj4dUzHNafD5xxYXRMelaf0hkry3w Gk9kBEzhCM6drRBBQG32hcQY1rHXDOGkkM2CAZmx4mrVlt4D/FpZypQ+mj3DJ34saSc0 eT2ZVK/3COMnAyxZ2g5QFI/4IA+HPZIzSOGif5Aq+bAEQ2E6S/DKTgZ2pAo2BgI86hGx 8OMnM5QIaX7KEe2dF+CBImS4fE1H2tAb6VP51ne+iQLh+PgnGNc1D19ApbdeWkYfrpC1 fXhgUWnINfk3Oh9otBX8hun+7QwC9nJY+WxdF0jQWohRJhx8me+MhcyFPrwtz34WLiOl RICQ==
X-Gm-Message-State: AOJu0Ywaso7eIc6kx6Nsiuyy14HL+A7Be3jp2Q8HdGi4PnyzJNgWBBYd 4tnoYxmp6cAtLN8gZdiJhzBAH6RSIpU=
X-Google-Smtp-Source: AGHT+IGDAJ+88DmJ+TaDvf7HrK07tKCiStXkEpFRGxeAeRJtjpBUlF2Nxqi7dNCqp0ursDzA/sfIUw==
X-Received: by 2002:a17:903:1210:b0:1c9:dd6a:5bee with SMTP id l16-20020a170903121000b001c9dd6a5beemr10026554plh.52.1698709958758; Mon, 30 Oct 2023 16:52:38 -0700 (PDT)
Received: from ?IPV6:2001:5a8:460f:2200:ddec:b7e0:8d6c:f5ca? ([2001:5a8:460f:2200:ddec:b7e0:8d6c:f5ca]) by smtp.gmail.com with ESMTPSA id i4-20020a17090332c400b001cc32261bdcsm68068plr.248.2023.10.30.16.52.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Oct 2023 16:52:37 -0700 (PDT)
Content-Type: multipart/alternative; boundary="------------NTT4AVqfcCzsykKlYkqdZWC0"
Message-ID: <a3b09c5b-bffe-c0b8-a648-fe5e85786994@gmail.com>
Date: Mon, 30 Oct 2023 16:52:36 -0700
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0
Content-Language: en-US
To: "Dale R. Worley" <worley@ariadne.com>
Cc: dispatch@ietf.org
References: <87cywvq0tr.fsf@hobgoblin.ariadne.com>
From: Michael Toomim <toomim@gmail.com>
In-Reply-To: <87cywvq0tr.fsf@hobgoblin.ariadne.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/dispatch/kTCogmYqt6Jd7KSclwYHhieH7iU>
Subject: Re: [dispatch] A State Synchronization Working Group
X-BeenThere: dispatch@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: DISPATCH Working Group Mail List <dispatch.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dispatch>, <mailto:dispatch-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dispatch/>
List-Post: <mailto:dispatch@ietf.org>
List-Help: <mailto:dispatch-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dispatch>, <mailto:dispatch-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Oct 2023 23:52:43 -0000

Thanks, Dale! This is a great prompt/question.

Dale R. Worley wrote:
> The state synchronization application I'm most familiar with is the SIP
> event notification model.  It is a framework and a number of different
> types of events are defined within the model.  The interesting event
> types have a state which is expressed in XML but is logically a set of
> name/value pairs (sometimes the values themselves are composed of
> name/value pairs) with each event type defining ways for the event
> notifier to send partial and full updates to the state.  Within those
> systems, an operation "replace range X with contents Y" is not so
> useful, as that operation implies a state structure which is a long
> ordered sequence of small data items.

The Braid model actually works great for SIP.

The "range replace" operations do not imply "a long ordered sequence" as 
you presume.  The "range" part is very general — it can express a "name" 
in a name/value pair, or a GraphQL query, or even a SQL query.

For example, let's say we want to update the presence of this SIP 
participant, expressed as PIDF:

    <?xml version="1.0" encoding="UTF-8"?> <impp:presence
    xmlns:impp="urn:ietf:params:xml:ns:pidf"
    xmlns:myex="http://id.mycompany.com/presence/"
    entity="pres:someone@example.com"> <impp:tuple id="tj25ds">
    <impp:status> <impp:basic>open</impp:basic> </impp:status>
    <myex:complexExtension> <myex:ex1
    impp:mustUnderstand="1">val1</myex:ex1> <myex:ex2>val2</myex:ex2>
    </myex:complexExtension> <impp:contact
    priority="0.725">tel:+09012345678</impp:contact> </impp:tuple>
    <myex:mytag>My extended presentity information</myex:mytag>
    </impp:presence>

We could update the status from "open" to "closed" with a Braid message 
like this:

    Content-Range: xpath
    //impp:presence/impp:tuple/impp:status/impp:basic/text()
    Content-Length: 5

    closed

In this case, we're saying that the *range* of the PIDF XML, as 
expressed via an *xpath*, has been replaced with the new value "closed".

A big advantage of this general mutation format is that we don't have to 
specify separately every event type for every type of mutation that 
might occur. We just have to specify the format of the data that we are 
synchronizing (e.g. the PIDF specification) and then use general 
mutations to express which parts of that format are changing.

This simplifies the synchronization specifications, and allows us to 
build general-purpose synchronization infrastructure. For example, 
rather than writing code to synchronize presence info, we can re-use a 
XML synchronizer. And it actually turns out that XML synchronizers can 
share a lot of their code with JSON synchronizers, DOM synchronizers, 
and so on!

Michael