cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2018-2020 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Pool.DB.Sqlite

Description

An implementation of the DBLayer which uses Persistent and SQLite.

Synopsis

Documentation

newDBLayer Source #

Arguments

:: Tracer IO PoolDbLog

Logging object

-> TimeInterpreter IO

Time interpreter for slot to time conversions

-> SqliteContext

A (thread-) safe wrapper for running db queries.

-> DBLayer IO

Sets up a connection to the SQLite database.

Database migrations are run to create tables if necessary.

If the given file path does not exist, it will be created by the sqlite library.

getDBLayer will provide the actual DBLayer implementation. The database should be closed with destroyDBLayer . If you use withDBLayer then both of these things will be handled for you.

withDBLayer Source #

Arguments

:: Tracer IO PoolDbLog

Logging object.

-> Maybe FilePath

Database file location, or Nothing for in-memory database.

-> TimeInterpreter IO

The time interpreter object.

-> ( DBLayer IO -> IO a)

Action to run.

-> IO a

Runs an action with a connection to the SQLite database.

Database migrations are run to create tables if necessary.

If the given file path does not exist, it will be created by the sqlite library.

withDecoratedDBLayer Source #

Arguments

:: DBDecorator IO

The database decorator.

-> Tracer IO PoolDbLog

Logging object

-> Maybe FilePath

Database file location, or Nothing for in-memory database

-> TimeInterpreter IO

The time interpreter object.

-> ( DBLayer IO -> IO a)

Action to run.

-> IO a

Runs an action with a connection to the SQLite database.

This function has the same behaviour as withDBLayer , but provides a way to decorate the created DBLayer object with a DBDecorator , useful for instrumenting or monitoring calls to database operations.

newtype DBDecorator a Source #

A decorator for the database layer, useful for instrumenting or monitoring calls to database operations.

undecoratedDB :: DBDecorator a Source #

The identity decorator.

Equivalent to an undecorated database.

defaultFilePath Source #

Arguments

:: FilePath

The directory in which the .sqlite file will be located.

-> FilePath

Return the preferred FilePath for the stake pool .sqlite file, given a parent directory.

data DatabaseView Source #

Represents a database view.

Constructors

DatabaseView

Fields