From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Mutating existing persistent data (was: sqlite3) Date: Mon, 06 Dec 2021 09:09:48 -0500 Message-ID: References: <87tufmjyai.fsf@gnus.org> <875ys2lyt0.fsf@yahoo.com> <87wnkhlxb9.fsf@yahoo.com> <2FD7D920-D92C-480B-B2AC-91A17F0397C4@mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35690"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: John Yates , Po Lu , "larsi@gnus.org" , Arthur Miller , "emacs-devel@gnu.org" To: Qiantan Hong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 06 15:23:53 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muEuD-0008wp-Sg for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Dec 2021 15:23:50 +0100 Original-Received: from localhost ([::1]:43562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muEuC-0002Rj-Qy for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Dec 2021 09:23:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muEhB-0002mq-C3 for emacs-devel@gnu.org; Mon, 06 Dec 2021 09:10:24 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muEgz-0006BN-3x for emacs-devel@gnu.org; Mon, 06 Dec 2021 09:10:15 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1059A440862; Mon, 6 Dec 2021 09:10:07 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D3275440964; Mon, 6 Dec 2021 09:10:05 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1638799805; bh=k8/rMOjDPT2LfIjK7zN1QJtNt5VkxQpuJpa1Gt6tN+g=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=U5DIgURgAcwgElk8PpbcaHhladQS8fHQYJHdDWY3F8J3n1ZSQf1Op3fdzc9ndqxdb 3iVVfF2/qCrly2qJxEaet8Oj79JLMjZg2mFFKGPiVTryy6TFnXb3WAnsA6yt9OLJGa jyGsSQ75t4nfP9JnjCZ7q02PtPQCWUlhhyNZeBdEclAYVIG5WjlpKSugijToxTHr+G FKC7Dc3vLRWwFKYzkwnsK2+YqZ06azLEnsRKfjGWY9seVGi7+aUX+iEpCKVq/G69R2 +HDm8sfhWvZRXeDolhsfHAKdoRq0l4IIT16DjdeSQOWGvneP/25TlKwIifNRnXh2mH U+UdKaz9zEDIg== Original-Received: from ceviche (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 901D6120983; Mon, 6 Dec 2021 09:10:05 -0500 (EST) In-Reply-To: (Qiantan Hong's message of "Mon, 6 Dec 2021 13:58:40 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281118 Archived-At: >> 1. A persistent hash table can be declared as :value-mutable t. >> In such case it will make an internal copy of its values ... >>=20 >> 2. A very radical approach (I consider it probably the =E2=80=9Cright=E2= =80=9D way). >> Add a cell-mutated-hook to Emacs Lisp VM =E2=80=A6 > > 3. Provide a function (SYNC-DATUM DATUM STORE), > and rely on user/package author to call it everytime > some datum which is also a part of a persistent store > is mutated. > This is probably the most flexible solution, with minimal > overhead, by shifting more responsibility to package authors. I don't think it includes enough information for the persistent data to be updated correctly in the presence of concurrent updates. You either need the application to provide some atomicity/transaction boundary information, or you need the application to send changes as changes rather than as the resulting state (i.e. send "increment x by 2" rather than "x is now 23"). Stefan