Documentation
¶
Overview ¶
Package exporter provides the base export functionality with support for multiple workers.
Index ¶
- Constants
- type Config
- type Exporter
- func (e *Exporter) Close()
- func (e *Exporter) ConnectWithRetries(numRetries int) (*pgxpool.Conn, error)
- func (e *Exporter) CreateWriters() (tileutils.TileWriter, tileutils.TileBulkWriter, func(), error)
- func (e *Exporter) Export() error
- func (e *Exporter) GenerateTileList(zooms []int) ([]tileutils.TileCoords, error)
- func (e *Exporter) GenerateZoomLevels() ([]int, error)
- func (e *Exporter) GetTotalProgress() int
- func (e *Exporter) ProgressReporter(ctx context.Context, totalTiles int)
- func (e *Exporter) UpdateProgress(workerNum, count int)
- type WorkerParams
Constants ¶
const (
ProgressUpdateRate = time.Duration(15) * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
TileJSON string // Input TileJSON filename
Output string // Output filename
MbTiles bool // True if outputting to a mbtiles file, otherwise outputs to a directory
Dsn string // DSN to connect to postgres to query tiles
InitSQLCmd string // Initialization SQL command to be sent on session start for custom configuration or tuning
NumWorkers int // Number of workers to process tiles in parallel
Version string // Tileset version written to the mbtiles file metadata
Zoom string // List of zooms to process, separated by a comma
TilesFile string // A list of custom tile coordinates to also generate, in addition to what is specified in zooms
MbTilesBatchSize uint // how many tiles to fetch in a batch and then write altogether to mbtiles
}
Config holds the configuration for the exporter
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter handles the tile export process
func NewExporter ¶
NewExporter creates a new exporter instance
func (*Exporter) ConnectWithRetries ¶
ConnectWithRetries attempts to acquire a database connection with retries
func (*Exporter) CreateWriters ¶
func (e *Exporter) CreateWriters() (tileutils.TileWriter, tileutils.TileBulkWriter, func(), error)
CreateWriters creates the appropriate tile writers based on configuration
func (*Exporter) GenerateTileList ¶
func (e *Exporter) GenerateTileList(zooms []int) ([]tileutils.TileCoords, error)
GenerateTileList creates the list of tiles to process
func (*Exporter) GenerateZoomLevels ¶
GenerateZoomLevels parses the zoom configuration and returns zoom levels
func (*Exporter) GetTotalProgress ¶
GetTotalProgress returns the total progress across all workers
func (*Exporter) ProgressReporter ¶
ProgressReporter runs a progress reporting loop
func (*Exporter) UpdateProgress ¶
UpdateProgress updates the progress for a worker
type WorkerParams ¶
type WorkerParams struct {
Num int
Wg *sync.WaitGroup
Exporter *Exporter
TileList []tileutils.TileCoords
GzipCompression bool
Writer tileutils.TileWriter
BulkWriter tileutils.TileBulkWriter
Conn *pgxpool.Conn
GzipCompressor *tileutils.WorkerGzipCompressor
GzipBufferPool *tileutils.BytesBufferPool
TileCache []mbtiles.TileData
TileCachePosition uint
TileBufferCache []*bytes.Buffer
Count uint
}
WorkerParams holds parameters for a tile worker
func (*WorkerParams) Do ¶
func (p *WorkerParams) Do()
Do processes a slice of tiles for a single worker
func (*WorkerParams) FetchTile ¶
func (p *WorkerParams) FetchTile(coord tileutils.TileCoords) error