github.com/MetalBlockchain/metalgo@v1.11.9/x/merkledb/batch.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package merkledb 5 6 import "github.com/MetalBlockchain/metalgo/database" 7 8 var _ database.Batch = (*batch)(nil) 9 10 type batch struct { 11 database.BatchOps 12 13 db *merkleDB 14 } 15 16 // Assumes [b.db.lock] isn't held. 17 func (b *batch) Write() error { 18 return b.db.commitBatch(b.Ops) 19 } 20 21 func (b *batch) Inner() database.Batch { 22 return b 23 }