session

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

SessionOption configures Session Registry.

func WithBrowserHost

func WithBrowserHost(host string) Option

func WithBrowserPort

func WithBrowserPort(port int) Option

func WithConfigCache

func WithConfigCache(dbAdapter database.ConfigCache) Option

func WithLogWriter

func WithLogWriter(lc logwriter.LogWriter) Option

func WithProxyHost

func WithProxyHost(host string) Option

func WithProxyPort

func WithProxyPort(port int) Option

func WithScreenshotWriter

func WithScreenshotWriter(sw screenshotwriter.ScreenshotWriter) Option

type Registry

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

func NewRegistry

func NewRegistry(maxSessions int, opts ...Option) (sr *Registry)

func (*Registry) CloseWait

func (sr *Registry) CloseWait(timeout time.Duration)

func (*Registry) CurrentSessions

func (sr *Registry) CurrentSessions() int

func (*Registry) Get

func (sr *Registry) Get(sessId int) *Session

func (*Registry) GetNextAvailable

func (sr *Registry) GetNextAvailable(ctx context.Context) (*Session, error)

GetNextAvailable returns next session from the pool.

func (*Registry) MaxSessions

func (sr *Registry) MaxSessions() int

func (*Registry) NewDirectSession

func (sr *Registry) NewDirectSession(uri, crawlExecutionId, jobExecutionId string) (*Session, error)

func (*Registry) Release

func (sr *Registry) Release(sess *Session)

type Session

type Session struct {
	Id int

	UserAgent string

	Requests requests.RequestRegistry

	RequestedUrl *frontierV1.QueuedUri
	CrawlConfig  *configV1.CrawlConfig

	PolitenessConfig *configV1.ConfigObject
	// contains filtered or unexported fields
}

func New

func New(sessionId int, opts ...Option) (*Session, error)

func (*Session) AbortFetch

func (sess *Session) AbortFetch() error

func (*Session) Context

func (sess *Session) Context() context.Context

func (*Session) Fetch

func (sess *Session) Fetch(ctx context.Context, phs *frontierV1.PageHarvestSpec) (result *frontier.RenderResult, err error)

func (*Session) GetReplacementScript

func (sess *Session) GetReplacementScript(uri string) *configV1.BrowserScript

func (*Session) Notify

func (sess *Session) Notify(reqId string) error

Jump to

Keyboard shortcuts

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