session

package
v0.0.0-...-b9e6601 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 18 Imported by: 3

README

Session Package

A Go package that provides session management via TGM (The Graph Market)

Overview

This package implements a session pool that manages worker connections through gRPC, providing session borrowing, keep-alive functionality and quota management.

Features

  • Session Pooling: Manages a pool of worker sessions with automatic lifecycle management
  • Keep-Alive: Maintains active sessions with configurable heartbeat intervals
  • Resource Management: Handles session borrowing and returning with proper cleanup
  • Configuration: Flexible configuration through URL-based config strings
  • Quota Management: Quota exhaustion detection that triggers a onError() callback

Example

See example

Configuration

Configure via URL string with parameters:

  • insecure=true - Skip TLS certificate verification
  • plaintext=true - Use unencrypted connections
  • request-keep-alive-delay=30s - Keep-alive interval
  • default-max-request-per-user=10 - Max concurrent sessions per user

Example: tgm://session.example.com?insecure=true&request-keep-alive-delay=60s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register()

Register registers the TGM session pool with dauth

Types

type Config

type Config struct {
	Endpoint                         string        // session endpoint, ex: session.thegraph.market
	Insecure                         bool          // skip certificate verification on endpoint
	Plaintext                        bool          // skip encryption on endpoint
	RequestKeepAliveDelay            time.Duration // delay between keep alive requests
	DefaultMaxRequestPerOrganization uint64        // default maximum requests per organization
	IndexerApiKey                    string        // indexer API key for X-Api-Key header
	MinimalWorkerLifeDuration        time.Duration // minimal worker life duration
}

Jump to

Keyboard shortcuts

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