db

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQL

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

SQL implements the DB interface

func (*SQL) AddBlob

func (s *SQL) AddBlob(hash string, length int, isStored bool) error

AddBlob adds a blob to the database.

func (*SQL) AddSDBlob

func (s *SQL) AddSDBlob(sdHash string, sdBlobLength int, sdBlob SdBlob) error

AddSDBlob insert the SD blob and all the content blobs. The content blobs are marked as "not stored", but they are tracked so reflector knows what it is missing.

func (*SQL) Block added in v1.1.0

func (s *SQL) Block(hash string) error

Block will mark a blob as blocked

func (*SQL) Connect

func (s *SQL) Connect(dsn string) error

Connect will create a connection to the database

func (*SQL) Delete added in v1.1.0

func (s *SQL) Delete(hash string) error

Delete will remove the blob from the db

func (*SQL) GetBlocked added in v1.1.0

func (s *SQL) GetBlocked() (map[string]bool, error)

GetBlocked will return a list of blocked hashes

func (*SQL) GetHashRange

func (s *SQL) GetHashRange() (string, string, error)

GetHashRange gets the smallest and biggest hashes in the db

func (*SQL) GetStoredHashesInRange

func (s *SQL) GetStoredHashesInRange(ctx context.Context, start, end bits.Bitmap) (ch chan bits.Bitmap, ech chan error)

GetStoredHashesInRange gets stored blobs with hashes in a given range, and sends the hashes into a channel

func (*SQL) HasBlob

func (s *SQL) HasBlob(hash string) (bool, error)

HasBlob checks if the database contains the blob information.

func (*SQL) HasBlobs

func (s *SQL) HasBlobs(hashes []string) (map[string]bool, error)

HasBlobs checks if the database contains the set of blobs and returns a bool map.

func (*SQL) MissingBlobsForKnownStream added in v1.0.3

func (s *SQL) MissingBlobsForKnownStream(sdHash string) ([]string, error)

MissingBlobsForKnownStream returns missing blobs for an existing stream WARNING: if the stream does NOT exist, no blob hashes will be returned, which looks like no blobs are missing

type SdBlob added in v0.1.2

type SdBlob struct {
	StreamName string `json:"stream_name"`
	Blobs      []struct {
		Length   int    `json:"length"`
		BlobNum  int    `json:"blob_num"`
		BlobHash string `json:"blob_hash,omitempty"`
		IV       string `json:"iv"`
	} `json:"blobs"`
	StreamType        string `json:"stream_type"`
	Key               string `json:"key"`
	SuggestedFileName string `json:"suggested_file_name"`
	StreamHash        string `json:"stream_hash"`
}

SdBlob is a special blob that contains information on the rest of the blobs in the stream

Jump to

Keyboard shortcuts

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