govector

package
v0.0.0-...-f54e1bb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: BSD-3-Clause Imports: 5 Imported by: 1

README

govector

import "github.com/blueprint-uservices/blueprint/runtime/plugins/govector"

package govector provides runtime GoVector components to be used by the govector plugin.

Package provides a GoVector logger that maintains vector clocks for a process and correctly propagates the vector clocks to other processes through its service-level instrumentation.

More info on govector: https://github.com/DistributedClocks/GoVector

Index

type GoVecLogger

GoVecLogger implements the GoVector interface (including the backend.Logger) by using the GoVector Logger

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

func GetLogger
func GetLogger() *GoVecLogger

Returns the current GoVectorLogger. Used by the govector plugin when instrumenting the server and client side objects of services.

func NewGoVecLogger
func NewGoVecLogger(ctx context.Context, loggerName string) (*GoVecLogger, error)

Returns a new object of type GoVecLogger

func (*GoVecLogger) Debug
func (g *GoVecLogger) Debug(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) Error
func (g *GoVecLogger) Error(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) GetSendCtx
func (g *GoVecLogger) GetSendCtx(ctx context.Context, msg string) ([]byte, error)

Implements GoVector interface

func (*GoVecLogger) Info
func (g *GoVecLogger) Info(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) Logf
func (g *GoVecLogger) Logf(ctx context.Context, options backend.LogOptions, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) UnpackReceiveCtx
func (g *GoVecLogger) UnpackReceiveCtx(ctx context.Context, msg string, bytes []byte) error

Implements GoVector interface

func (*GoVecLogger) Warn
func (g *GoVecLogger) Warn(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

type GoVector

Represents the GoVector logger interface exposed to applications and used by the GoVector plugin

type GoVector interface {
    // Gets the govector context (the vector clock) as a bytes array that will be sent from one process to another
    GetSendCtx(ctx context.Context, msg string) ([]byte, error)
    // Unpacks the received context `bytes` and merges the context into the process' current vector clock
    UnpackReceiveCtx(ctx context.Context, msg string, bytes []byte) error
}

Generated by gomarkdoc

Documentation

Overview

package govector provides runtime GoVector components to be used by the govector plugin.

Package provides a GoVector logger that maintains vector clocks for a process and correctly propagates the vector clocks to other processes through its service-level instrumentation.

More info on govector: https://github.com/DistributedClocks/GoVector

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoVecLogger

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

GoVecLogger implements the GoVector interface (including the backend.Logger) by using the GoVector Logger

func GetLogger

func GetLogger() *GoVecLogger

Returns the current GoVectorLogger. Used by the govector plugin when instrumenting the server and client side objects of services.

func NewGoVecLogger

func NewGoVecLogger(ctx context.Context, loggerName string) (*GoVecLogger, error)

Returns a new object of type GoVecLogger

func (*GoVecLogger) Debug

func (g *GoVecLogger) Debug(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) Error

func (g *GoVecLogger) Error(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) GetSendCtx

func (g *GoVecLogger) GetSendCtx(ctx context.Context, msg string) ([]byte, error)

Implements GoVector interface

func (*GoVecLogger) Info

func (g *GoVecLogger) Info(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) Logf

func (g *GoVecLogger) Logf(ctx context.Context, options backend.LogOptions, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

func (*GoVecLogger) UnpackReceiveCtx

func (g *GoVecLogger) UnpackReceiveCtx(ctx context.Context, msg string, bytes []byte) error

Implements GoVector interface

func (*GoVecLogger) Warn

func (g *GoVecLogger) Warn(ctx context.Context, format string, args ...any) (context.Context, error)

Implements backend.Logger interface

type GoVector

type GoVector interface {
	// Gets the govector context (the vector clock) as a bytes array that will be sent from one process to another
	GetSendCtx(ctx context.Context, msg string) ([]byte, error)
	// Unpacks the received context `bytes` and merges the context into the process' current vector clock
	UnpackReceiveCtx(ctx context.Context, msg string, bytes []byte) error
}

Represents the GoVector logger interface exposed to applications and used by the GoVector plugin

Jump to

Keyboard shortcuts

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