]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/stack: add mechanism to notify callers on reload
authorPatrick Steinhardt <ps@pks.im>
Tue, 26 Nov 2024 06:42:59 +0000 (07:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Nov 2024 08:18:38 +0000 (17:18 +0900)
commiteb22c1b46b85f7fac8467f991890d50853e4ca4d
treeeae568370d99e59ad0e5b4ea87a811b0eaff985a
parent96e7cb83b65622c8189678ea52d469786bdf0240
reftable/stack: add mechanism to notify callers on reload

Reftable stacks are reloaded in two cases:

  - When calling `reftable_stack_reload()`, if the stat-cache tells us
    that the stack has been modified.

  - When committing a reftable addition.

While callers can figure out the second case, they do not have a
mechanism to figure out whether `reftable_stack_reload()` led to an
actual reload of the on-disk data. All they can do is thus to assume
that data is always being reloaded in that case.

Improve the situation by introducing a new `on_reload()` callback to the
reftable options. If provided, the function will be invoked every time
the stack has indeed been reloaded. This allows callers to invalidate
data that depends on the current stack data.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/reftable-writer.h
reftable/stack.c