Skip to content

Commit

Permalink
Simplify DB pipeline (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
outofforest authored Dec 12, 2024
1 parent 1dd9072 commit 95f679a
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 182 deletions.
4 changes: 0 additions & 4 deletions alloc/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ type Deallocator[A Address] struct {

// Deallocate deallocates single node.
func (d *Deallocator[A]) Deallocate(nodeAddress A) {
if nodeAddress == 0 {
return
}

d.release = append(d.release, nodeAddress)
if len(d.release) == cap(d.release) {
d.sinkCh <- d.release
Expand Down
2 changes: 0 additions & 2 deletions alloc/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ func NewState(
persistentAllocationCh, singularityPersistentAddress := NewAllocationCh[types.PersistentAddress](
persistentSize, nodesPerGroup, false)

singularityNode := (*types.SingularityNode)(unsafe.Add(dataP, types.NodeLength*singularityVolatileAddress))
return &State{
nodesPerGroup: nodesPerGroup,
singularityNodeRoot: types.NodeRoot{
Hash: &singularityNode.Hash,
Pointer: &types.Pointer{
Revision: 1,
VolatileAddress: singularityVolatileAddress,
Expand Down
7 changes: 2 additions & 5 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func BenchmarkBalanceTransfer(b *testing.B) {
panic(err)
}

var size uint64 = 20 * 1024 * 1024 * 1024
var size uint64 = 5 * 1024 * 1024 * 1024
state, stateDeallocFunc, err := alloc.NewState(
size, store.Size(),
100,
Expand All @@ -77,13 +77,10 @@ func BenchmarkBalanceTransfer(b *testing.B) {
}
defer stateDeallocFunc()

db, err := quantum.New(quantum.Config{
db := quantum.New(quantum.Config{
State: state,
Store: store,
})
if err != nil {
panic(err)
}

ctx, cancel := context.WithCancel(logger.WithLogger(context.Background(), logger.New(logger.DefaultConfig)))
b.Cleanup(cancel)
Expand Down
Loading

0 comments on commit 95f679a

Please sign in to comment.