Re: [core] [T2TRG] OCF Observe on special interfaces, design question, RFC requirements?

Klaus Hartke <hartke@projectcool.de> Tue, 09 July 2019 22:25 UTC

Return-Path: <hartke@projectcool.de>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A22FB1201B8 for <core@ietfa.amsl.com>; Tue, 9 Jul 2019 15:25:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.6
X-Spam-Level:
X-Spam-Status: No, score=-2.6 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=unavailable autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jm7qkB3WgonU for <core@ietfa.amsl.com>; Tue, 9 Jul 2019 15:25:00 -0700 (PDT)
Received: from wp382.webpack.hosteurope.de (wp382.webpack.hosteurope.de [80.237.133.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BCC77120141 for <core@ietf.org>; Tue, 9 Jul 2019 15:24:58 -0700 (PDT)
Received: from mail-qt1-f182.google.com ([209.85.160.182]); authenticated by wp382.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1hkyXe-00030Z-Us; Wed, 10 Jul 2019 00:24:55 +0200
Received: by mail-qt1-f182.google.com with SMTP id n11so328421qtl.5 for <core@ietf.org>; Tue, 09 Jul 2019 15:24:54 -0700 (PDT)
X-Gm-Message-State: APjAAAVxNhxSSW0G+0MkCKRizKTzJMm8w93wu4gVgYacFfg8PI4NcpaU JddOCr72jMVD9Mqd8vOd1lGeuYxm+UdwFwqIN+g=
X-Google-Smtp-Source: APXvYqxxBPLHnECCn+4NHHSSa9epozXgZRn4yrdlRTEJ7GsJDjpd0CyQahE+/zaYiWfH4mldWTrslHR9hCoHKoXpzVI=
X-Received: by 2002:ac8:6114:: with SMTP id a20mr20836452qtm.283.1562711093915; Tue, 09 Jul 2019 15:24:53 -0700 (PDT)
MIME-Version: 1.0
References: <166B0435-8C96-4B83-98CB-A1D6F0838335@smartthings.com>
In-Reply-To: <166B0435-8C96-4B83-98CB-A1D6F0838335@smartthings.com>
From: Klaus Hartke <hartke@projectcool.de>
Date: Wed, 10 Jul 2019 00:24:18 +0200
X-Gmail-Original-Message-ID: <CAAzbHvYGVtNiw5taGMaVVRe4RuN9s2y4Y6RkJxR06Nk=w3CiTQ@mail.gmail.com>
Message-ID: <CAAzbHvYGVtNiw5taGMaVVRe4RuN9s2y4Y6RkJxR06Nk=w3CiTQ@mail.gmail.com>
To: Michael Koster <michael.koster=40smartthings.com@dmarc.ietf.org>
Cc: core <core@ietf.org>, "t2trg@irtf.org" <t2trg@irtf.org>
Content-Type: text/plain; charset="UTF-8"
X-bounce-key: webpack.hosteurope.de; hartke@projectcool.de; 1562711098; 4e637650;
X-HE-SMSGID: 1hkyXe-00030Z-Us
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/0omb9m51sE_ae9guuKKR0bxNL7s>
Subject: Re: [core] [T2TRG] OCF Observe on special interfaces, design question, RFC requirements?
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Jul 2019 22:25:02 -0000

Michael Koster wrote:
> Does this violate any of the current requirements in RFC7252 or RFC7641, or other specifications?

I think RFC 7641 is pretty clear that a 2.05 (Content) notification
contains a resource state representation and not a representation of
changes since the last notification.

RFC 7641: "The goal of the protocol is to keep the resource state
observed by the client as closely in sync with the actual state at the
server as possible."

"Notifications are additional responses sent by the server in reply to
the single extended GET request that created the registration. [...]
The only difference between a notification and a normal   response is
the presence of the Observe Option."

RFC 7252: "The payload returned with the [2.05 (Content)] response is
a representation of the target resource."

RFC 7641: "As notifications are just additional responses sent by the
server in reply to a GET request, they are subject to caching as
defined in Section 5.6 of RFC 7252 [RFC7252]."

A good way to think of the Observe mechanism is to see it an
optimization of polling: Every time a client gets the response in
reply to a GET request without Observe option, it gets the current
representation if the resource. That representation only depends on
the resource state, never on the response to a previous request. Every
time a client gets a notification in reply to a GET request with
Observe option, it gets the current representation if the resource.
That representation only depends on the resource state, never on a
previous notification.

When observing a resource with a rather large representation, it might
often make more sense to observe a projection of that resource. That
is, to observe a resource X whose state depends on the state of
another resource Y.

Examples of possible resource state projections if the state of Y is a number:

* The state of X is that number rounded to a multiple of 5.
* The state of X is that number clipped to the range 0--100.
* The state of X is the moving average of that number over the last 60 seconds.
* The state of X is that number sampled every other second.
* The state of X is the difference between that number and 9000.

Examples of possible resource state projections if the state of Y is a
list of items:

* The state of X is the number of changes to that list since its creation.
* The state of X is the timestamp of the last change to that list.
* The state of X is a list of the last 10 additions/removals to that list.
* The state of X is a list of the additions/removals to that list
since 2019-07-10T00:21:00+0200.

Anything where the notifications depend on previous notifications
(e.g., time elapsed since the last notification, value has changed by
more than some value since the last notification, additions/removals
to some list since the last notification, etc.) is not a projection of
resource state and thus not pollable nor observable.

Klaus