mirror of
https://github.com/dolthub/dolt.git
synced 2026-03-17 23:56:33 -05:00
rename mmap table reader
This commit is contained in:
@@ -50,7 +50,7 @@ type fsTablePersister struct {
|
||||
}
|
||||
|
||||
func (ftp *fsTablePersister) Open(ctx context.Context, name addr, chunkCount uint32, stats *Stats) (chunkSource, error) {
|
||||
return fileTableReader(ftp.dir, name, chunkCount, ftp.q, ftp.fc)
|
||||
return newFileTableReader(ftp.dir, name, chunkCount, ftp.q, ftp.fc)
|
||||
}
|
||||
|
||||
func (ftp *fsTablePersister) Persist(ctx context.Context, mt *memTable, haver chunkReader, stats *Stats) (chunkSource, error) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type mmapTableReader struct {
|
||||
type fileTableReader struct {
|
||||
tableReader
|
||||
fc *fdCache
|
||||
h addr
|
||||
@@ -40,7 +40,7 @@ const (
|
||||
fileBlockSize = 1 << 12
|
||||
)
|
||||
|
||||
func fileTableReader(dir string, h addr, chunkCount uint32, q MemoryQuotaProvider, fc *fdCache) (cs chunkSource, err error) {
|
||||
func newFileTableReader(dir string, h addr, chunkCount uint32, q MemoryQuotaProvider, fc *fdCache) (cs chunkSource, err error) {
|
||||
path := filepath.Join(dir, h.String())
|
||||
|
||||
index, err := func() (ti onHeapTableIndex, err error) {
|
||||
@@ -78,27 +78,27 @@ func fileTableReader(dir string, h addr, chunkCount uint32, q MemoryQuotaProvide
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &mmapTableReader{
|
||||
return &fileTableReader{
|
||||
tr,
|
||||
fc,
|
||||
h,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (mmtr *mmapTableReader) hash() (addr, error) {
|
||||
func (mmtr *fileTableReader) hash() (addr, error) {
|
||||
return mmtr.h, nil
|
||||
}
|
||||
|
||||
func (mmtr *mmapTableReader) Close() error {
|
||||
func (mmtr *fileTableReader) Close() error {
|
||||
return mmtr.tableReader.Close()
|
||||
}
|
||||
|
||||
func (mmtr *mmapTableReader) Clone() (chunkSource, error) {
|
||||
func (mmtr *fileTableReader) Clone() (chunkSource, error) {
|
||||
tr, err := mmtr.tableReader.Clone()
|
||||
if err != nil {
|
||||
return &mmapTableReader{}, err
|
||||
return &fileTableReader{}, err
|
||||
}
|
||||
return &mmapTableReader{tr, mmtr.fc, mmtr.h}, nil
|
||||
return &fileTableReader{tr, mmtr.fc, mmtr.h}, nil
|
||||
}
|
||||
|
||||
type cacheReaderAt struct {
|
||||
|
||||
@@ -52,7 +52,7 @@ func TestMmapTableReader(t *testing.T) {
|
||||
err = os.WriteFile(filepath.Join(dir, h.String()), tableData, 0666)
|
||||
require.NoError(t, err)
|
||||
|
||||
trc, err := fileTableReader(dir, h, uint32(len(chunks)), &noopQuotaProvider{}, fc)
|
||||
trc, err := newFileTableReader(dir, h, uint32(len(chunks)), &noopQuotaProvider{}, fc)
|
||||
require.NoError(t, err)
|
||||
assertChunksInReader(chunks, trc, assert)
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ func (nbs *NomsBlockStore) GetChunkLocations(hashes hash.HashSet) (map[hash.Hash
|
||||
f := func(css chunkSources) error {
|
||||
for _, cs := range css {
|
||||
switch tr := cs.(type) {
|
||||
case *mmapTableReader:
|
||||
case *fileTableReader:
|
||||
offsetRecSlice, _, err := tr.findOffsets(gr)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user