Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
6e757371
Commit
6e757371
authored
Jan 24, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4f4592cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
wcfs/zδtail_i64.go
wcfs/zδtail_i64.go
+15
-13
No files found.
wcfs/zδtail_i64.go
View file @
6e757371
// Code generated by gen-δtail I64 int64; DO NOT EDIT.
// Code generated by gen-δtail I64 int64; DO NOT EDIT.
// (from lab.nexedi.com/kirr/neo/go/zodb @ v1.9-20
78-gae3c4829
)
// (from lab.nexedi.com/kirr/neo/go/zodb @ v1.9-20
80-gd1f63f32
)
// Copyright (C) 2018-2019 Nexedi SA and Contributors.
// Copyright (C) 2018-2019 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Kirill Smelkov <kirr@nexedi.com>
...
@@ -24,18 +24,18 @@ package main
...
@@ -24,18 +24,18 @@ package main
import
"lab.nexedi.com/kirr/neo/go/zodb"
import
"lab.nexedi.com/kirr/neo/go/zodb"
// XXX do we really need ΔTailI64 to be exported from zodb?
// (other users are low level caches + maybe ZEO/NEO -> zplumbing? but then import cycle)
import
(
import
(
"fmt"
"fmt"
)
)
// XXX do we really need ΔTailI64 to be exported from zodb?
// (other users are low level caches + maybe ZEO/NEO -> zplumbing? but then import cycle)
// ΔTailI64 represents tail of revisional changes.
// ΔTailI64 represents tail of revisional changes.
//
//
// It semantically consists of
// It semantically consists of
//
//
// [](rev↑, []id)
// [](rev↑, []id)
XXX + head?
//
//
// and index
// and index
//
//
...
@@ -48,10 +48,10 @@ import (
...
@@ -48,10 +48,10 @@ import (
//
//
// It provides operations to
// It provides operations to
//
//
// - XXX Head
// - append information to the tail about next revision,
// - append information to the tail about next revision,
// - forget information in the tail past specified revision, and
// - forget information in the tail past specified revision, and
// - query the tail about what is last revision that changed an id.
// - query the tail about what is last revision that changed an id.
// - query the tail about what head/tail XXX?
//
//
// ΔTailI64 is safe to access for multiple-readers / single writer.
// ΔTailI64 is safe to access for multiple-readers / single writer.
//
//
...
@@ -60,6 +60,7 @@ import (
...
@@ -60,6 +60,7 @@ import (
// oid - ZODB object identifier, when ΔTailI64 represents changes to ZODB objects,
// oid - ZODB object identifier, when ΔTailI64 represents changes to ZODB objects,
// #blk - file block number, when ΔTailI64 represents changes to a file.
// #blk - file block number, when ΔTailI64 represents changes to a file.
type
ΔTailI64
struct
{
type
ΔTailI64
struct
{
head
zodb
.
Tid
tailv
[]
δRevEntryI64
tailv
[]
δRevEntryI64
lastRevOf
map
[
int64
]
zodb
.
Tid
// index for LastRevOf queries
lastRevOf
map
[
int64
]
zodb
.
Tid
// index for LastRevOf queries
...
@@ -78,9 +79,12 @@ func NewΔTailI64() *ΔTailI64 {
...
@@ -78,9 +79,12 @@ func NewΔTailI64() *ΔTailI64 {
return
&
ΔTailI64
{
lastRevOf
:
make
(
map
[
int64
]
zodb
.
Tid
)}
return
&
ΔTailI64
{
lastRevOf
:
make
(
map
[
int64
]
zodb
.
Tid
)}
}
}
// XXX + .Head() -> max(rev) XXX or 0 if len(tailv) == 0?
// Head returns database state starting from which δtail has history coverage. XXX
//
// For newly created ΔTailI64 Head returns 0.
// Head is ↑, in particular it does not go back to 0 when δtail becomes empty.
func
(
δtail
*
ΔTailI64
)
Head
()
zodb
.
Tid
{
func
(
δtail
*
ΔTailI64
)
Head
()
zodb
.
Tid
{
panic
(
"TODO"
)
return
δtail
.
head
}
}
// XXX add way to extend coverage without appending changed data? (i.e. if a
// XXX add way to extend coverage without appending changed data? (i.e. if a
...
@@ -91,13 +95,11 @@ func (δtail *ΔTailI64) Head() zodb.Tid {
...
@@ -91,13 +95,11 @@ func (δtail *ΔTailI64) Head() zodb.Tid {
// rev must be ↑.
// rev must be ↑.
func
(
δtail
*
ΔTailI64
)
Append
(
rev
zodb
.
Tid
,
changev
[]
int64
)
{
func
(
δtail
*
ΔTailI64
)
Append
(
rev
zodb
.
Tid
,
changev
[]
int64
)
{
// check rev↑
// check rev↑
// XXX better also check even when δtail is ø (after forget)
if
δtail
.
head
>=
rev
{
if
l
:=
len
(
δtail
.
tailv
);
l
>
0
{
panic
(
fmt
.
Sprintf
(
"δtail.Append: rev not ↑: %s -> %s"
,
δtail
.
head
,
rev
))
if
revPrev
:=
δtail
.
tailv
[
l
-
1
]
.
rev
;
revPrev
>=
rev
{
panic
(
fmt
.
Sprintf
(
"δtail.Append: rev not ↑: %s -> %s"
,
revPrev
,
rev
))
}
}
}
δtail
.
head
=
rev
δtail
.
tailv
=
append
(
δtail
.
tailv
,
δRevEntryI64
{
rev
,
changev
})
δtail
.
tailv
=
append
(
δtail
.
tailv
,
δRevEntryI64
{
rev
,
changev
})
for
_
,
id
:=
range
changev
{
for
_
,
id
:=
range
changev
{
δtail
.
lastRevOf
[
id
]
=
rev
δtail
.
lastRevOf
[
id
]
=
rev
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment