Documentation
¶
Index ¶
- Constants
- func OpenDB(file string, readonly bool, cache int, writeBuf int) (*leveldb.DB, error)
- func StartHttpServer(log log.Logger, listenAddr string, indexData *IndexData, ...) *http.Server
- func UpdatePerf(ctx context.Context, log log.Logger, perf *leveldb.DB, spec *common.Spec, ...) error
- func UpdateTiles(log log.Logger, tiles, perf *leveldb.DB, startEpoch, endEpoch common.Epoch) error
- type AttestationsLookup
- type Backend
- type BlockLookup
- type BlockRootLookup
- type BoundedIndices
- type ImageHandler
- type IndexData
- type RandaoLookup
- type SlotAttestations
- type StateLookup
- type Tile
- type ValidatorPerformance
Constants ¶
const ( // KeyPerf is a: // 3 byte prefix for per-epoch performance keying, followed by: // 8 byte big-endian epoch value. (big endian to make db byte-prefix iteration and range-slices follow epoch order) // // The epoch key represents the boundary when the data became available. // I.e. epoch == 2 means that 0 == prev and 1 == current were processed. // // Values under this key are snappy block-compressed. // // The value is a []ValidatorPerformance KeyPerf string = "prf" )
const ( // KeyTile is a: // 3 byte prefix for tile keying, followed by: // 1 byte tile type // 1 byte zoom. // 4 byte big endian X // 4 byte big endian Y // // Note: the X is first, so the DB range iterate can range over epochs at zoom 0. // // Values under this key are snappy block-compressed. // // The uncompressed value is 4 squares of tileSize x tileSize, one for R, one for G, B, and A // The squares encode column by column. // // We can encode tiles in with R, G, B, A grouped together separately. // And implement the image.Image interface to map back to an image. // This way we compress better, and don't store as much alpha-channel data. KeyTile string = "til" )
Variables ¶
This section is empty.
Functions ¶
func OpenDB ¶
OpenDB opens a level DB.
Filepath to locate db at. Readonly to limit db writes. Cache in megabytes to trade memory for better performance. writeBuf in megabytes to improve writing performance
func StartHttpServer ¶
func UpdatePerf ¶
Types ¶
type AttestationsLookup ¶
type AttestationsLookup func(slot common.Slot) (phase0.Attestations, error)
type BoundedIndices ¶
type BoundedIndices []common.BoundedIndex
type ImageHandler ¶
func (*ImageHandler) HandleImgRequest ¶
func (s *ImageHandler) HandleImgRequest(tileType uint8) http.Handler
type SlotAttestations ¶
type SlotAttestations struct { Slot common.Slot Attestations phase0.Attestations }
type Tile ¶
type Tile struct { R []byte G []byte B []byte A []byte // added to x lookups OffsetX int // added to y lookups OffsetY int // Shifts x and y by given amount to create zoomed image effect, // while really serving the same tile. // This is useful to zoom in more than 1:1 pixel definition, // enlarging tiles without image scaling artifacts on client side. Scale uint8 }
Tile represents an image tile, as stored in the DB. R,G,B,A are slices stored next to eachother, since they compress better individually.
Each color slice encodes column by column first, since correlation is larger per-column, for better compression. I.e. values 0,1,2,3,4...tilesize-1 all correspond to column 0 (X == 0).
func (*Tile) At ¶
At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.
func (*Tile) Bounds ¶
Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).
func (*Tile) ColorModel ¶
ColorModel returns the Image's color model.
type ValidatorPerformance ¶
type ValidatorPerformance uint32
const ( // and the next 64 values (6 bits). Always non-zero InclusionDistance ValidatorPerformance = 0x00_00_01_00 InclusionDistanceMask = 0x00_00_ff_00 // source is always correct, or wouldn't be included on-chain TargetCorrect ValidatorPerformance = 0x00_ff_00_00 // up to 64, or 0xff if unknown HeadDistance ValidatorPerformance = 0x01_00_00_00 ValidatorExists ValidatorPerformance = 0x00_00_00_01 )