cursor

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cursor provides access to DocumentDB cursors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry provides access to DocumentDB cursors.

func NewRegistry

func NewRegistry(l *slog.Logger) *Registry

NewRegistry creates a new cursor registry.

func (*Registry) Close

func (r *Registry) Close(ctx context.Context)

Close closes all cursors in the registry.

func (*Registry) CloseCursor

func (r *Registry) CloseCursor(ctx context.Context, id int64) bool

CloseCursor removes the cursor with the given id from the registry and closes it, if any. It returns true if the cursor was found and removed.

It attempts a clean close by sending the exit message to PostgreSQL. However, this could block so ctx is available to limit the time to wait (up to 3 seconds). The underlying connection will always be called regardless of any other errors.

func (*Registry) Collect

func (r *Registry) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Registry) Describe

func (r *Registry) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (*Registry) GetCursor

func (r *Registry) GetCursor(id int64) (wirebson.RawDocument, *pgx.Conn)

GetCursor returns the continuation and the connection for the given cursor id.

func (*Registry) NewCursor

func (r *Registry) NewCursor(ctx context.Context, id int64, continuation wirebson.RawDocument, conn *pgx.Conn)

NewCursor stores a cursor with given continuation and connection (if any).

Passed context is used for logging/tracing, and for closing existing cursor, if any. See Registry.CloseCursor.

func (*Registry) UpdateCursor

func (r *Registry) UpdateCursor(ctx context.Context, id int64, continuation wirebson.RawDocument)

UpdateCursor updates existing cursor with given continuation, or closes it if continuation is empty.

Passed context is used for logging/tracing, and for closing the cursor (see Registry.CloseCursor).

Jump to

Keyboard shortcuts

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