Re: [core] ETag vs. Block Identifier

Christian Amsüss <christian@amsuess.com> Thu, 11 June 2020 07:34 UTC

Return-Path: <christian@amsuess.com>
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 CC6403A0F57; Thu, 11 Jun 2020 00:34:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham 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 gT1_HK6kIb_y; Thu, 11 Jun 2020 00:34:47 -0700 (PDT)
Received: from prometheus.amsuess.com (prometheus.amsuess.com [5.9.147.112]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6F81A3A0F1E; Thu, 11 Jun 2020 00:34:46 -0700 (PDT)
Received: from poseidon-mailhub.amsuess.com (unknown [IPv6:2a02:b18:c13b:8010:a800:ff:fede:b1bd]) by prometheus.amsuess.com (Postfix) with ESMTPS id 5BB2040015; Thu, 11 Jun 2020 09:34:42 +0200 (CEST)
Received: from poseidon-mailbox.amsuess.com (hermes.amsuess.com [10.13.13.254]) by poseidon-mailhub.amsuess.com (Postfix) with ESMTP id 39414151; Thu, 11 Jun 2020 09:34:41 +0200 (CEST)
Received: from hephaistos.amsuess.com (089144216015.atnat0025.highway.a1.net [89.144.216.15]) by poseidon-mailbox.amsuess.com (Postfix) with ESMTPSA id A16D264; Thu, 11 Jun 2020 09:34:40 +0200 (CEST)
Received: (nullmailer pid 2003416 invoked by uid 1000); Thu, 11 Jun 2020 07:34:39 -0000
Date: Thu, 11 Jun 2020 09:34:39 +0200
From: Christian Amsüss <christian@amsuess.com>
To: mohamed.boucadair@orange.com
Cc: "Carsten Bormann (cabo@tzi.org)" <cabo@tzi.org>, "core@ietf.org" <core@ietf.org>, "draft-bosh-core-new-block@ietf.org" <draft-bosh-core-new-block@ietf.org>
Message-ID: <20200611073439.GA2002284@hephaistos.amsuess.com>
References: <29244_1591858421_5EE1D4F5_29244_364_1_787AE7BB302AE849A7480A190F8B9330314DC153@OPEXCAUBMA2.corporate.adroot.infra.ftgroup>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="SLDf9lqlvOQaIe6s"
Content-Disposition: inline
In-Reply-To: <29244_1591858421_5EE1D4F5_29244_364_1_787AE7BB302AE849A7480A190F8B9330314DC153@OPEXCAUBMA2.corporate.adroot.infra.ftgroup>
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/P_lZvxhv0VLh1qQ0Q_Pj9bqRHjw>
Subject: Re: [core] ETag vs. Block Identifier
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: Thu, 11 Jun 2020 07:34:50 -0000

Hello Med,

On Thu, Jun 11, 2020 at 06:53:40AM +0000, mohamed.boucadair@orange.com wrote:
> It was suggested during yesterday's meeting that ETag can be used to
> achieve what BID is intended for in draft-bosh-core-new-block (block4
> case). We still don't see how that would work given that only a 2.03
> will be sent as per Section 5.10.6.2 of RFC7252.
> 
> Can you please clarify how a missing block can be sent back as a
> response to a GET+ETag?

By simply not including the ETag in the request (as that would, as you
point out, indicate to the server that the client just needs
confirmation that this block is still (2.03) Valid).

I think this is best illustrated by reusing the new-block-02 example
figure 5 and 6 (where the B4 option is written without an MID, and the
values are used in the ETag instead):

           CoAP        CoAP
          Client      Server
            |          |
            +--------->| NON GET /path M:0x01 T:0xf0 O:0 B4:0/0/1024
            |<---------+ NON 2.05 M:0xf1 T:0xf0 O:1234 ETag:21 B4:0/1/1024
            |<---------+ NON 2.05 M:0xf2 T:0xf0 O:1234 ETag:21 B4:1/1/1024
            |<---------+ NON 2.05 M:0xf3 T:0xf0 O:1234 ETag:21 B4:2/1/1024
            |<---------+ NON 2.05 M:0xf4 T:0xf0 O:1234 ETag:21 B4:3/0/1024
                 ...
              [[Observe triggered]]
            |<---------+ NON 2.05 M:0xf5 T:0xf0 O:1235 ETag:22 B4:0/1/1024
            |<---------+ NON 2.05 M:0xf6 T:0xf0 O:1235 ETag:22 B4:1/1/1024
            |<---------+ NON 2.05 M:0xf7 T:0xf0 O:1235 ETag:22 B4:2/1/1024
            |<---------+ NON 2.05 M:0xf8 T:0xf0 O:1235 ETag:22 B4:3/0/1024
                ...


           CoAP        CoAP
          Client      Server
            |          |
                ...
               [[Observe triggered]]
            |<---------+ NON 2.05 M:0xf9 T:0xf0 O:1236 ETag:23 B4:0/1/1024
            |     X<---+ NON 2.05 M:0xfa T:0xf0 O:1236 ETag:23 B4:1/1/1024
            |     X<---+ NON 2.05 M:0xfb T:0xf0 O:1236 ETag:23 B4:2/1/1024
            |<---------+ NON 2.05 M:0xfc T:0xf0 O:1236 ETag:23 B4:3/0/1024
            |          |
         [[Client realises blocks are missing and asks for the missing
              ones in one go. The client does not give any indication of
              which "version" it is missing a block -- it will always be
              assumed it's the latest one.]]
            +--------->| NON GET /path M:0x02 T:0xf1 B4:1/0/1024\
            |          |                             B4:2/0/1024
            |     X<---+ NON 2.05 M:0xfd T:0xf1 ETag:23 B4:1/1/1024
            |<---------+ NON 2.05 M:0xfe T:0xf1 ETag:23 B4:2/1/1024
            |          |
         [[Get final missing block]]
            +--------->| NON GET /path M:0x03 T:0xf2 B4:1/0/1024
            |<---------+ NON 2.05 M:0xff T:0xf2 ETag:23 B4:1/1/1024
                ...

When, during the transfer of missing blocks, the server does change the
representation and mints a new ETag, then the blocks of the older
representation are not accessible any more. This is consistent with the
rest of Observe behavior (once a new state is there, clients can only
get the new state and the old is lost to everyone who didn't fully get
it), and allows constrained server implementations (as the server is
under no obligation to keep old representations around).

Kind regards
Christian

-- 
The detailed semantics of CoAP methods are "almost, but not entirely
unlike" [HHGTTG] those of HTTP methods.
[HHGTTG]: Adams, D., "The Hitchhiker's Guide to the Galaxy", October 1979.
  -- Shelby, et al., Internet-Draft Constrained Application Protocol (CoAP)