context

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CopySessionMetadata added in v0.8.0

func CopySessionMetadata(dst context.Context, src context.Context)

func GetCollectionRef

func GetCollectionRef(ctx context.Context) (cid *configV1.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 HasStateHandle added in v0.8.0

func HasStateHandle(ctx context.Context) bool

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 NewRequestContext added in v0.8.0

func NewRequestContext(ctx context.Context, preserveSessionMetadata bool) context.Context

func NewRequestContextFrom added in v0.8.0

func NewRequestContextFrom(ctx context.Context, source context.Context, preserveSessionMetadata bool) context.Context

func OpenSessions

func OpenSessions() int64

func RecordProxyDataAware

func RecordProxyDataAware(ctx context.Context) context.Context

func RegisterConnectRequest

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

func ResetRequestState added in v0.8.0

func ResetRequestState(ctx context.Context, preserveSessionMetadata bool)

func SetCollectionRef

func SetCollectionRef(ctx context.Context, cid *configV1.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 WithStateHandle added in v0.8.0

func WithStateHandle(ctx context.Context, source context.Context) context.Context

func WrapIfNecessary

func WrapIfNecessary(ctx context.Context) context.Context

Types

type CwcSession

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

type RecordContext

type RecordContext struct {
	Error error

	CloseFunc func()

	Method            string
	Uri               *url.URL
	RequestId         string
	CrawlExecutionId  string
	JobExecutionId    string
	CollectionRef     *configV1.ConfigRef
	IpAddress         string
	FetchTimesTamp    time.Time
	Meta              *contentwriterV1.WriteRequest_Meta
	CrawlLog          *logV1.CrawlLog
	ReplacementScript *configV1.BrowserScript

	FoundInCache              bool
	PrecludedByRobots         bool
	HasExplicitHarvestHeaders 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) RegisterNewRequest

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

func (*RecordContext) SaveCrawlLog

func (rc *RecordContext) SaveCrawlLog() error

func (*RecordContext) SendMeta

func (rc *RecordContext) SendMeta() (reply *contentwriterV1.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 context.Context, reqErr error) error

func (*RecordContext) SendResponseError

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

func (*RecordContext) Session

func (rc *RecordContext) Session() int64

Jump to

Keyboard shortcuts

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