package table
import (
"bytes"
"context"
"fmt"
"path/filepath"
"github.com/thanos-io/objstore"
)
const (
hdfsVersionHintFile = "version-hint.text"
parquetFileExt = ".parquet"
)
type hdfsTable struct {
version int
*baseTable
}
func NewHDFSTable (ver int , ident Identifier , meta Metadata , location string , bucket objstore .Bucket ) Table {
return &hdfsTable {
version : ver ,
baseTable : &baseTable {
identifier : ident ,
metadata : meta ,
metadataLocation : location ,
bucket : bucket ,
},
}
}
func (t *hdfsTable ) SnapshotWriter (options ...WriterOption ) (SnapshotWriter , error ) {
writer := &hdfsSnapshotWriter {}
writer .snapshotWriter = NewSnapshotWriter (writer .commit , t .version , t .bucket , t , options ...)
return writer , nil
}
type hdfsSnapshotWriter struct {
snapshotWriter
}
func (s *hdfsSnapshotWriter ) commit (ctx context .Context , ver int ) error {
hint := []byte (fmt .Sprintf ("%v" , ver ))
path := filepath .Join (s .metadataDir (), hdfsVersionHintFile )
return s .bucket .Upload (ctx , path , bytes .NewReader (hint ))
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .