node

package
v0.0.0-...-c286f04 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package node holds storage node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(storage HandlerStorage) http.Handler

func Register

func Register(ctx context.Context, httpClient HTTPClient, listenPort string) error

Register itself on the front node.

Types

type Chunks

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

func NewChunks

func NewChunks(dir string, tracerProvider trace.TracerProvider, meterProvider metric.MeterProvider) (*Chunks, error)

func (*Chunks) Delete

func (c *Chunks) Delete(ctx context.Context, id uuid.UUID) (rerr error)

func (*Chunks) Read

func (c *Chunks) Read(ctx context.Context, id uuid.UUID, w io.Writer) (rerr error)

func (*Chunks) Write

func (c *Chunks) Write(ctx context.Context, id uuid.UUID, r io.Reader) (rerr error)

Write chunk to disk.

type Client

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

func NewClient

func NewClient(baseURL string, httpClient HTTPClient, tracerProvider trace.TracerProvider) *Client

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id uuid.UUID) (rerr error)

Delete chunk. Idempotent.

func (*Client) Read

func (c *Client) Read(ctx context.Context, id uuid.UUID, w io.Writer) (rerr error)

Read chunk to w writer.

func (*Client) Write

func (c *Client) Write(ctx context.Context, id uuid.UUID, r io.Reader) (rerr error)

Write chunk from r reader.

type HTTPClient

type HTTPClient interface {
	Do(r *http.Request) (*http.Response, error)
}

type Handler

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

type HandlerStorage

type HandlerStorage interface {
	Read(ctx context.Context, id uuid.UUID, w io.Writer) error
	Write(ctx context.Context, id uuid.UUID, r io.Reader) error
	Delete(ctx context.Context, id uuid.UUID) error
}

Jump to

Keyboard shortcuts

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