common

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_api_v1_common_common_proto protoreflect.FileDescriptor

Functions

func ChallengesUDCounter

func ChallengesUDCounter() metric.Int64UpDownCounter

func ComputeUntil

func ComputeUntil(until *time.Time, timeout *time.Duration) *time.Time

ComputeUntil returns an instance until date based on a challenge until date and the challenge timeout.

No until, no timeout: nil No until, timeout: now+timeout until, no timeout: until until, timeout: min(now+timeout, until)

func InstancesUDCounter

func InstancesUDCounter() metric.Int64UpDownCounter

func LClose

func LClose(lock lock.RWLock)

LClose is a helper that logs any error during the lock close call.

func LockChallenge

func LockChallenge(challengeId string) (lock.RWLock, error)

func LockInstance

func LockInstance(challengeId, sourceId string) (lock.RWLock, error)

func LockTOTW

func LockTOTW() (lock.RWLock, error)

Types

type QueryServer

type QueryServer[T any] struct {
	// contains filtered or unexported fields
}

QueryServer is a generic implementation of a synchronous gRPC server. Use it when dealing with a query that streams asynchronously, but gRPC requires it to be else it will crash the stream.

func NewQueryServer

func NewQueryServer[T any](server grpc.ServerStream) *QueryServer[T]

NewQueryServer creates a throwable server to stream synchronously to a gRPC stream server.

func (*QueryServer[T]) SendMsg

func (qs *QueryServer[T]) SendMsg(in T) error

SendMsg synchronously when asynchrouneous tasks is possible.

Jump to

Keyboard shortcuts

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