github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/internal/private/flush_external.go (about) 1 // Copyright 2020 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 // of this source code is governed by a BSD-style license that can be found in 3 // the LICENSE file. 4 5 package private 6 7 import "github.com/zuoyebang/bitalostable/internal/manifest" 8 9 // FlushExternalTable is a hook for linking files into L0 without assigning a 10 // global sequence number, mimicking a flush. FlushExternalTable takes a 11 // *bitalostable.DB, the path and the metadata of a sstable to flush directly into 12 // L0. 13 // 14 // Calls to flush a sstable may fail if the file's sequence numbers are not 15 // greater than the current commit pipeline's sequence number. On success the 16 // commit pipeline's published sequence number will be moved to the file's 17 // highest sequence number. 18 // 19 // This function is wrapped in a safer, more ergonomic API in the 20 // internal/replay package. Clients should use the replay package rather than 21 // calling this private hook directly. 22 var FlushExternalTable func(interface{}, string, *manifest.FileMetadata) error 23 24 // RatchetSeqNum is a hook for allocating and publishing sequence numbers up 25 // to a specific absolute value. Its first parameter is a *bitalostable.DB and its 26 // second is the new next sequence number. RatchetSeqNum does nothing if the 27 // next sequence is already greater than or equal to nextSeqNum. 28 // 29 // This function is used by the internal/replay package to ensure replayed 30 // operations receive the same absolute sequence number. 31 var RatchetSeqNum func(interface{}, uint64)