storage

package
v0.0.0-...-1543c3c Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

type MemoryStorage struct {
	Watchers  []WatcherRecord
	Responses []ResponseRecord
}

func NewMemorystore

func NewMemorystore() (*MemoryStorage, error)

func (*MemoryStorage) Close

func (s *MemoryStorage) Close()

func (*MemoryStorage) GetLastResponses

func (s *MemoryStorage) GetLastResponses(watcher int, n int) ([]ResponseRecord, error)

func (*MemoryStorage) GetWatchers

func (s *MemoryStorage) GetWatchers() ([]WatcherRecord, error)

func (*MemoryStorage) InsertResponse

func (s *MemoryStorage) InsertResponse(watcher int, online bool, responsetime time.Duration) error

func (*MemoryStorage) InsertTestData

func (s *MemoryStorage) InsertTestData()

func (*MemoryStorage) InsertWatcher

func (s *MemoryStorage) InsertWatcher(url string, watcher string) (WatcherRecord, error)

type PostgresStore

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

func NewPostgresStore

func NewPostgresStore() (*PostgresStore, error)

func (*PostgresStore) Close

func (pg *PostgresStore) Close()

func (*PostgresStore) GetLastResponses

func (pg *PostgresStore) GetLastResponses(watcher int, len int) ([]ResponseRecord, error)

func (*PostgresStore) GetWatchers

func (pg *PostgresStore) GetWatchers() ([]WatcherRecord, error)

func (*PostgresStore) InsertResponse

func (pg *PostgresStore) InsertResponse(watcher int, online bool, responsetime time.Duration) error

func (*PostgresStore) InsertWatcher

func (pg *PostgresStore) InsertWatcher(url string, watcher string) (WatcherRecord, error)

type ResponseRecord

type ResponseRecord struct {
	Watcher     int
	Online      bool
	ReponseTime time.Duration
}

type Storage

type Storage interface {
	Close()
	GetWatchers() ([]WatcherRecord, error)
	InsertWatcher(url string, watcher string) (WatcherRecord, error)
	GetLastResponses(watcher int, len int) ([]ResponseRecord, error)
	InsertResponse(watcher int, online bool, responsetime time.Duration) error
}

type WatcherRecord

type WatcherRecord struct {
	ID      int
	URL     string
	Watcher string
}

Jump to

Keyboard shortcuts

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