idx

package
v0.0.0-...-5129a00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDbNoAccess         = errors.New("database could not be accessed")
	ErrDbNotExist         = errors.New("database does not exist")
	ErrDbNotOpen          = errors.New("database could not be opened")
	ErrInitDbAlreadyExist = errors.New("database already exists - the initialization was not forced")
)
View Source
var (
	ErrDatabaseNotOpen = errors.New("database not open")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Address    string
	DbPath     string
	DbVariant  string
	DbMaxLimit int
	ErrWriter  io.Writer
	OutWriter  io.Writer
	Port       string
	Indexes    map[platform.Variant]IndexConfig
}

Config instructs Idx how to download source file and where to put it.

type GameTDBAdapter

type GameTDBAdapter struct {
	// contains filtered or unexported fields
}

GameTDBAdapter transforms data from GameTDB source to be usable by Index and DB packages This is the gluing component which should be used for transforming data provided by GameTDB source to fit any other package required As a result parsing, indexing and persistence packages can be decoupled using interfaces and are not dependent on the shape of GameTDB source

func NewGameTDBAdapter

func NewGameTDBAdapter(platformID string, provider gametdb.ModelProvider) GameTDBAdapter

NewGameTDBAdapter returns new instance of GameTDB adapter

func (GameTDBAdapter) GameSources

func (adapt GameTDBAdapter) GameSources() []index.GameSource

GameSources returns all games adapted to the format indexer accepts

func (GameTDBAdapter) PlatformProvider

func (adapt GameTDBAdapter) PlatformProvider() db.PlatformProvider

PlatformProvider returns all data adapted to the format database accepts

type IndexConfig

type IndexConfig struct {
	IndexFilepath   string
	IndexVariant    string
	Name            string
	DocType         string
	SourceFilepath  string
	ArchiveFilepath string
	SourceFilename  string
}

IndexConfig instructs how unziping, parsing and indexing should be performed

type InitializeDbConfig

type InitializeDbConfig struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg Config) *Server

func (*Server) InitializeDatabase

func (s *Server) InitializeDatabase(cfg InitializeDbConfig) error

func (*Server) OpenDatabase

func (s *Server) OpenDatabase() error

OpenDatabase opens the database pointed to by application config.

func (*Server) PreparePlatform

func (s *Server) PreparePlatform(variant platform.Variant, notifier progress.Notifier) error

PreparePlatform unzips and parses source file, creates Index related to the platfrom and populates the database.

func (*Server) ServeGRPC

func (s *Server) ServeGRPC() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL