sprintsd

package module
v0.0.0-...-26e8ea5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 9 Imported by: 0

README

sprintsd

WARNING! Work In Progress

Go Report

A simple google cloud run service discovery

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAvailable = errors.New("not available")

Functions

func GetRunServiceURL

func GetRunServiceURL(ctx context.Context, name string) (string, error)

GetRunServiceURL retrieves the URL of a cloud run service.

Types

type Discovery

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

func NewDiscovery

func NewDiscovery(store Store) *Discovery

func (*Discovery) Enroll

func (d *Discovery) Enroll(ctx context.Context, reg *Registration) error

func (*Discovery) Forget

func (d *Discovery) Forget(ctx context.Context, name string) error

func (*Discovery) Locate

func (d *Discovery) Locate(ctx context.Context, name string) (
	r *Registration, err error,
)

type Firestore

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

func NewFirestore

func NewFirestore(client *firestore.Client, collection string) *Firestore

func (*Firestore) Delete

func (fs *Firestore) Delete(context.Context, string) error

func (*Firestore) Query

func (*Firestore) Save

func (fs *Firestore) Save(ctx context.Context, reg *Registration) error

type Registration

type Registration struct {
	ID      string `json:"id" firestore:"id"`
	Name    string `json:"name" firestore:"name"`
	Address string `json:"address" firestore:"address"`
	Port    int    `json:"port" firestore:"port"`
}

type Service

type Service interface {
	Enroll(context.Context, *Registration) error
	Locate(context.Context, string) (*Registration, error)
	Forget(context.Context, string) error
}

type Store

type Store interface {
	Save(context.Context, *Registration) error
	Query(context.Context, string) (*Registration, error)
	Delete(context.Context, string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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