context

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlreadyCompleted = errors2.New("already completed")

Functions

func GetCollectionRef

func GetCollectionRef(ctx context.Context) (cid *config.ConfigRef)

func GetConnectError

func GetConnectError(ctx context.Context) (err error)

func GetCrawlExecutionId

func GetCrawlExecutionId(ctx context.Context) (eid string)

func GetHost

func GetHost(ctx context.Context) (host string)

func GetIp

func GetIp(ctx context.Context) (ip string)

func GetJobExecutionId

func GetJobExecutionId(ctx context.Context) (jid string)

func GetPort

func GetPort(ctx context.Context) (port string)

func GetRequestId

func GetRequestId(ctx context.Context) (reqid string)

func GetUri

func GetUri(ctx context.Context) (uri *url.URL)

func LogWithContext

func LogWithContext(ctx context.Context, componentName string) *logger.Logger

func LogWithContextAndRequest

func LogWithContextAndRequest(ctx context.Context, req *http.Request, componentName string) *logger.Logger

func LogWithRecordContext

func LogWithRecordContext(rc *RecordContext, componentName string) *logger.Logger

func OpenSessions

func OpenSessions() int64

func RecordProxyDataAware

func RecordProxyDataAware(ctx context.Context) context.Context

func RegisterConnectRequest

func RegisterConnectRequest(ctx filters.Context, conn *serviceconnections.Connections, proxyId int32, req *http.Request, uri *url.URL)

func SetCollectionRef

func SetCollectionRef(ctx context.Context, cid *config.ConfigRef)

func SetConnectError

func SetConnectError(ctx context.Context, err error)

func SetConnectErrorIfNotExists

func SetConnectErrorIfNotExists(ctx context.Context, err error)

func SetCrawlExecutionId

func SetCrawlExecutionId(ctx context.Context, eid string)

func SetHost

func SetHost(ctx context.Context, host string)

func SetIp

func SetIp(ctx context.Context, ip string)

func SetJobExecutionId

func SetJobExecutionId(ctx context.Context, jid string)

func SetPort

func SetPort(ctx context.Context, port string)

func SetRecordContext

func SetRecordContext(ctx context.Context, rc *RecordContext)

func SetRequestId

func SetRequestId(ctx context.Context, reqid string)

func SetUri

func SetUri(ctx context.Context, uri *url.URL)

func WrapIfNecessary

func WrapIfNecessary(ctx context.Context) filters.Context

Types

type BccSession

type BccSession struct {
	browsercontroller.BrowserController_DoClient
	// contains filtered or unexported fields
}

type CwcSession

type CwcSession struct {
	contentwriter.ContentWriter_WriteClient
	// contains filtered or unexported fields
}

type RecordContext

type RecordContext struct {
	Error error

	CloseFunc func()

	Method            string
	Uri               *url.URL
	FetchTimesTamp    time.Time
	Meta              *contentwriter.WriteRequest_Meta
	CrawlLog          *logV1.CrawlLog
	ReplacementScript *config.BrowserScript

	FoundInCache      bool
	PrecludedByRobots bool

	InitDone bool
	ProxyId  int32
	// contains filtered or unexported fields
}

func GetRecordContext

func GetRecordContext(ctx context.Context) (recordContext *RecordContext)

func NewRecordContext

func NewRecordContext() *RecordContext

NewRecordContext creates a new RecordContext

func (*RecordContext) CancelContentWriter

func (rc *RecordContext) CancelContentWriter(msg string) error

func (*RecordContext) Init

func (rc *RecordContext) Init(proxyId int32, conn *serviceconnections.Connections, req *http.Request, uri *url.URL) *RecordContext

func (*RecordContext) NotifyAllDataReceived

func (rc *RecordContext) NotifyAllDataReceived() error

func (*RecordContext) NotifyDataReceived

func (rc *RecordContext) NotifyDataReceived() error

func (*RecordContext) RegisterNewRequest

func (rc *RecordContext) RegisterNewRequest(ctx filters.Context) error

func (*RecordContext) ResponseCompleted

func (rc *RecordContext) ResponseCompleted(resp *http.Response, writeErr error)

func (*RecordContext) SaveCrawlLog

func (rc *RecordContext) SaveCrawlLog() error

func (*RecordContext) SendMeta

func (rc *RecordContext) SendMeta() (reply *contentwriter.WriteReply, err error)

func (*RecordContext) SendPayload

func (rc *RecordContext) SendPayload(recNum int32, p []byte) error

func (*RecordContext) SendProtocolHeader

func (rc *RecordContext) SendProtocolHeader(recNum int32, p []byte) error

func (*RecordContext) SendRequestError

func (rc *RecordContext) SendRequestError(ctx filters.Context, reqErr error) error

func (*RecordContext) SendResponseError

func (rc *RecordContext) SendResponseError(ctx filters.Context, respErr error) error

func (*RecordContext) Session

func (rc *RecordContext) Session() int64

func (*RecordContext) WaitForCompleted

func (rc *RecordContext) WaitForCompleted()

Jump to

Keyboard shortcuts

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