aboutsummaryrefslogtreecommitdiffstats
path: root/cache/cached.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-12-22 00:48:00 +0100
committerMichael Muré <batolettre@gmail.com>2022-12-22 00:48:00 +0100
commitd65e8837aa7bb1a6abb6892b9f2664e1b7edb02e (patch)
tree331b05b689182b4d2bf43fd7cf92ca03b055bff0 /cache/cached.go
parent9b98fc06489353053564b431ac0c0d73a5c55a56 (diff)
downloadgit-bug-d65e8837aa7bb1a6abb6892b9f2664e1b7edb02e.tar.gz
cache: generic withSnapshot, some cleanup
Diffstat (limited to 'cache/cached.go')
-rw-r--r--cache/cached.go47
1 files changed, 1 insertions, 46 deletions
diff --git a/cache/cached.go b/cache/cached.go
index 5a31ee59..ce1d6637 100644
--- a/cache/cached.go
+++ b/cache/cached.go
@@ -9,52 +9,7 @@ import (
"github.com/MichaelMure/git-bug/util/lamport"
)
-// type withSnapshot[SnapT dag.Snapshot, OpT dag.OperationWithApply[SnapT]] struct {
-// dag.Interface[SnapT, OpT]
-// snap dag.Snapshot
-// }
-//
-//
-// func (ws *withSnapshot[SnapT, OpT]) Compile() dag.Snapshot {
-// if ws.snap == nil {
-// snap := ws.Interface.Compile()
-// ws.snap = snap
-// }
-// return ws.snap
-// }
-//
-// // Append intercept Bug.Append() to update the snapshot efficiently
-// func (ws *withSnapshot[SnapT, OpT]) Append(op OpT) {
-// ws.Interface.Append(op)
-//
-// if ws.snap == nil {
-// return
-// }
-//
-// op.Apply(ws.snap)
-// ws.snap. = append(ws.snap.Operations, op)
-// }
-//
-// // Commit intercept Bug.Commit() to update the snapshot efficiently
-// func (ws *withSnapshot[SnapT, OpT]) Commit(repo repository.ClockedRepo) error {
-// err := ws.Interface.Commit(repo)
-//
-// if err != nil {
-// ws.snap = nil
-// return err
-// }
-//
-// // Commit() shouldn't change anything of the bug state apart from the
-// // initial ID set
-//
-// if ws.snap == nil {
-// return nil
-// }
-//
-// ws.snap.id = ws.Interface.Id()
-// return nil
-// }
-
+// CachedEntityBase provide the base function of an entity managed by the cache.
type CachedEntityBase[SnapT dag.Snapshot, OpT dag.Operation] struct {
repo repository.ClockedRepo
entityUpdated func(id entity.Id) error