Commit 76f6fa11 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f9f4b93d
// Copyright (C) 2017 Nexedi SA and Contributors. // Copyright (C) 2017-2018 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -31,7 +31,7 @@ import ( ...@@ -31,7 +31,7 @@ import (
"lab.nexedi.com/kirr/go123/xcontainer/list" "lab.nexedi.com/kirr/go123/xcontainer/list"
) )
// TODO handle invalidations from the database. // FIXME watch over storage and update cache to new commits there.
// XXX managing LRU under 1 big gcMu might be bad for scalability. // XXX managing LRU under 1 big gcMu might be bad for scalability.
// TODO maintain nhit / nmiss + way to read cache stats // TODO maintain nhit / nmiss + way to read cache stats
...@@ -46,8 +46,9 @@ type Cache struct { ...@@ -46,8 +46,9 @@ type Cache struct {
mu sync.RWMutex mu sync.RWMutex
// cache is fully synchronized with storage for transactions with tid <= head. // cache is currently synchronized with storage for transactions with tid <= head.
// XXX clarify ^^^ (it means if revCacheEntry.head=∞ it is Cache.head) // XXX clarify ^^^ (it means if revCacheEntry.head=∞ it is Cache.head) XXX
// XXX load(at > head) -> wait?
head Tid head Tid
entryMap map[Oid]*oidCacheEntry // oid -> oid's cache entries entryMap map[Oid]*oidCacheEntry // oid -> oid's cache entries
...@@ -89,7 +90,7 @@ type revCacheEntry struct { ...@@ -89,7 +90,7 @@ type revCacheEntry struct {
// ( this way we do not need to bump .head to next tid in many // ( this way we do not need to bump .head to next tid in many
// unchanged cache entries when a transaction invalidation comes ) // unchanged cache entries when a transaction invalidation comes )
// //
// .head can be > cache.head and still finite - that represents a // .head can be > cache.head and still finite - that represents a XXX
// case when load with tid > cache.head was called. // case when load with tid > cache.head was called.
head Tid head Tid
......
// Copyright (C) 2017 Nexedi SA and Contributors. // Copyright (C) 2017-2018 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -613,7 +613,7 @@ func TestCache(t *testing.T) { ...@@ -613,7 +613,7 @@ func TestCache(t *testing.T) {
// XXX verify caching vs ctx cancel // XXX verify caching vs ctx cancel
// XXX verify db inconsistency checks // XXX verify db inconsistency checks
// XXX verify loading with before > cache.before // XXX verify loading with at > cache.head
} }
type Checker struct { type Checker struct {
......
...@@ -159,6 +159,7 @@ func (s *storage) Prefetch(ctx context.Context, xid Xid) { ...@@ -159,6 +159,7 @@ func (s *storage) Prefetch(ctx context.Context, xid Xid) {
} }
// watcher // watcher
// FIXME tests
// watchRequest represents request to add/del a watch. // watchRequest represents request to add/del a watch.
type watchRequest struct { type watchRequest struct {
......
...@@ -437,7 +437,7 @@ type CommitEvent struct { ...@@ -437,7 +437,7 @@ type CommitEvent struct {
// Watcher allows to be notified of changes to database. // Watcher allows to be notified of changes to database.
// //
// Watcher is safe to be used from multiple goroutines simultaneously. // Watcher is safe to use from multiple goroutines simultaneously.
type Watcher interface { type Watcher interface {
// AddWatch registers watchq to be notified of database changes. // AddWatch registers watchq to be notified of database changes.
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment