globalservice

package
v0.0.0-...-2c780d5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(nc *nats.Conn) *Client

func NewClientWithCredsPath

func NewClientWithCredsPath(credsPath string) (*Client, error)

func (*Client) ClaimOneTimeCode

func (c *Client) ClaimOneTimeCode(code string, oauthIdentifier string) (*models.NatsterContext, error)

func (*Client) Drain

func (c *Client) Drain()

func (*Client) GenerateOneTimeCode

func (c *Client) GenerateOneTimeCode(context models.NatsterContext) (*models.OtcGenerateResponse, error)

func (*Client) GetBoundContextByOAuth

func (c *Client) GetBoundContextByOAuth(oauthId string) (*models.ContextQueryResponse, error)

This is to be called by the natster.io site when someone logs into the site, which will provide an OAuth identifier. If this OAuth ID has been bound to a context, we should be able to download that context and the corresponding credentials

func (*Client) GetMyCatalogs

func (c *Client) GetMyCatalogs() (*[]models.CatalogShareSummary, error)

func (*Client) PublishEvent

func (c *Client) PublishEvent(eventType string, catalog string, target string, rawData json.RawMessage) error

func (*Client) PublishHeartbeat

func (c *Client) PublishHeartbeat(nctx *models.NatsterContext, library *medialibrary.MediaLibrary) error

func (*Client) ValidateCatalogName

func (c *Client) ValidateCatalogName(catalog string) (*models.CatalogNameValidationResult, error)

func (*Client) Whoami

func (c *Client) Whoami() (*models.WhoamiResponse, error)

type GlobalService

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

func New

func New(nc *nats.Conn) *GlobalService

func (*GlobalService) AllCatalogs

func (srv *GlobalService) AllCatalogs() ([]string, error)

func (*GlobalService) CatalogRevision

func (srv *GlobalService) CatalogRevision(catalog string) int64

func (*GlobalService) CreateKeyValueContext

func (srv *GlobalService) CreateKeyValueContext() (jetstream.KeyValue, error)

func (*GlobalService) GetBoundContext

func (srv *GlobalService) GetBoundContext(myAccountKey string) (*models.ContextBoundEvent, error)

Retrieves the most recent bound context by loading the account projection, if any

func (*GlobalService) GetBoundContextByOAuth

func (srv *GlobalService) GetBoundContextByOAuth(oauthId string) (*models.NatsterContext, error)

TODO: this needs to be converted to use a projection rather than running through the event stream every time

func (*GlobalService) GetCatalog

func (srv *GlobalService) GetCatalog(catalog string) (*catalogProjection, error)

func (*GlobalService) GetMyCatalogs

func (srv *GlobalService) GetMyCatalogs(myAccountKey string) ([]models.CatalogShareSummary, error)

Reads the account projection for the given querying account and returns a flattened list of directional shares to and from this account

func (*GlobalService) GetOAuthIdForAccount

func (srv *GlobalService) GetOAuthIdForAccount(accountKey string) (*string, error)

func (*GlobalService) GetTotalInitializedAccounts

func (srv *GlobalService) GetTotalInitializedAccounts() (uint64, error)

Returns the total number of accounts in which developers have run `natster init`

func (*GlobalService) GetTotalSharedCatalogs

func (srv *GlobalService) GetTotalSharedCatalogs() (uint64, error)

This number is currently inaccurate due to the "unshare" feature. TODO: we can fix this when we add a global stats projection

func (*GlobalService) IsCatalogOnline

func (srv *GlobalService) IsCatalogOnline(catalog string) bool

func (*GlobalService) Start

func (srv *GlobalService) Start(version, commit, date string) error

func (*GlobalService) Stop

func (srv *GlobalService) Stop() error

Jump to

Keyboard shortcuts

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