Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
828d95cd
Unverified
Commit
828d95cd
authored
Nov 19, 2020
by
Janoš Guljaš
Committed by
GitHub
Nov 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add to localstore gc index on ModePutSync (#973)
parent
7191e6a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
mode_put.go
pkg/localstore/mode_put.go
+5
-1
mode_put_test.go
pkg/localstore/mode_put_test.go
+3
-1
No files found.
pkg/localstore/mode_put.go
View file @
828d95cd
...
@@ -235,7 +235,7 @@ func (db *DB) putUpload(batch *leveldb.Batch, binIDs map[uint8]uint64, item shed
...
@@ -235,7 +235,7 @@ func (db *DB) putUpload(batch *leveldb.Batch, binIDs map[uint8]uint64, item shed
}
}
// putSync adds an Item to the batch by updating required indexes:
// putSync adds an Item to the batch by updating required indexes:
// - put to indexes: retrieve, pull
// - put to indexes: retrieve, pull
, gc
// The batch can be written to the database.
// The batch can be written to the database.
// Provided batch and binID map are updated.
// Provided batch and binID map are updated.
func
(
db
*
DB
)
putSync
(
batch
*
leveldb
.
Batch
,
binIDs
map
[
uint8
]
uint64
,
item
shed
.
Item
)
(
exists
bool
,
gcSizeChange
int64
,
err
error
)
{
func
(
db
*
DB
)
putSync
(
batch
*
leveldb
.
Batch
,
binIDs
map
[
uint8
]
uint64
,
item
shed
.
Item
)
(
exists
bool
,
gcSizeChange
int64
,
err
error
)
{
...
@@ -260,6 +260,10 @@ func (db *DB) putSync(batch *leveldb.Batch, binIDs map[uint8]uint64, item shed.I
...
@@ -260,6 +260,10 @@ func (db *DB) putSync(batch *leveldb.Batch, binIDs map[uint8]uint64, item shed.I
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
0
,
err
return
false
,
0
,
err
}
}
gcSizeChange
,
err
=
db
.
setGC
(
batch
,
item
)
if
err
!=
nil
{
return
false
,
0
,
err
}
return
false
,
gcSizeChange
,
nil
return
false
,
gcSizeChange
,
nil
}
}
...
...
pkg/localstore/mode_put_test.go
View file @
828d95cd
...
@@ -107,9 +107,11 @@ func TestModePutSync(t *testing.T) {
...
@@ -107,9 +107,11 @@ func TestModePutSync(t *testing.T) {
po
:=
db
.
po
(
ch
.
Address
())
po
:=
db
.
po
(
ch
.
Address
())
binIDs
[
po
]
++
binIDs
[
po
]
++
newRetrieveIndexesTest
(
db
,
ch
,
wantTimestamp
,
0
)(
t
)
newRetrieveIndexesTest
WithAccess
(
db
,
ch
,
wantTimestamp
,
wantTimestamp
)(
t
)
newPullIndexTest
(
db
,
ch
,
binIDs
[
po
],
nil
)(
t
)
newPullIndexTest
(
db
,
ch
,
binIDs
[
po
],
nil
)(
t
)
newPinIndexTest
(
db
,
ch
,
leveldb
.
ErrNotFound
)(
t
)
newPinIndexTest
(
db
,
ch
,
leveldb
.
ErrNotFound
)(
t
)
newItemsCountTest
(
db
.
gcIndex
,
tc
.
count
)(
t
)
newIndexGCSizeTest
(
db
)(
t
)
}
}
})
})
}
}
...
...
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