server

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TraceMiddleware

func TraceMiddleware(logger log.Logger, tracerProvider trace.TracerProvider) echo.MiddlewareFunc

TraceMiddleware extract parent span from query parameters or from referer header. And start new span.

Types

type DocumentID

type DocumentID uint64

DocumentID is store key.

func (DocumentID) String added in v0.9.1

func (id DocumentID) String() string

type EchoServer

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

EchoServer for browser render.

func ProvideServer

func ProvideServer(
	ctx context.Context,
	handler *Handler,
	tracerProvider trace.TracerProvider,
) (*EchoServer, func(), error)

ProvideServer create, start server and return closer function.

func (*EchoServer) Close

func (server *EchoServer) Close(ctx context.Context)

Close HTTP server.

func (*EchoServer) GetURL

func (server *EchoServer) GetURL(
	ctx context.Context,
	templateName pdfrender.TemplateName,
	documentHash DocumentID,
	requestID string,
) string

GetURL on internal server by templateName and documentID.

type Handler

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

Handler of CDP render Server.

func NewHandler

func NewHandler(
	documentsStore Store,
	templatesStoreConsumer templates.StoreConsumer,
	logger log.Logger,
	tracerProvider trace.TracerProvider,
) *Handler

NewHandler constructor.

func (*Handler) Callback added in v0.11.1

func (handler *Handler) Callback(c echo.Context) error

Callback trigger printing of PDF.

func (*Handler) Get

func (handler *Handler) Get(c echo.Context) error

Get document HTML.

func (*Handler) GetAsset

func (handler *Handler) GetAsset(c echo.Context) error

GetAsset handler.

revive:disable:function-length // TODO: change type of documentID to string

type MapStore

type MapStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MapStore is default implementation for Store.

func NewMapStore

func NewMapStore(randSrc rand.Source) *MapStore

NewMapStore constructor.

func (*MapStore) Add

func (mapStore *MapStore) Add(
	document pdfrender.Document,
	events pdfrender.CallbackEventChan,
) DocumentID

Add document to store.

func (*MapStore) Get

func (mapStore *MapStore) Get(documentID DocumentID) (
	pdfrender.Document,
	pdfrender.CallbackEventChan,
	bool,
)

Get document by ID.

func (*MapStore) Remove

func (mapStore *MapStore) Remove(documentID DocumentID)

Remove document by ID.

type Server

type Server interface {
	GetURL(
		ctx context.Context,
		templateName pdfrender.TemplateName,
		documentHash DocumentID,
		requestID string,
	) string
}

Server provide GetURL.

type Store

Store interface for Handler.

type TraceIDNotProvidedError

type TraceIDNotProvidedError struct{}

TraceIDNotProvidedError returns from extractSpanContextFromRequest.

func NewTraceIDNotProvidedError

func NewTraceIDNotProvidedError() *TraceIDNotProvidedError

NewTraceIDNotProvidedError construct new TraceIDNotProvidedError.

func (*TraceIDNotProvidedError) Error

Error implements error interface.

Jump to

Keyboard shortcuts

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