fsprovider

package
v0.0.0-...-cced42b Latest Latest
Warning

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

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

Documentation

Overview

Package fsprovider implements a simple RUN-DSP server using files in a directory structure as dataset entries. TODO: Describe how path is ascertained from Aiuth IMPORTANT: This provider is not meant for production use, it is just to demonstrate how to implement a RUN-DSP provider, IDs also don't persist through restarts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	providerv1alpha1.UnimplementedProviderServiceServer
	// contains filtered or unexported fields
}

Server implements both the ProviderService, and the publish http handler.

func New

func New(ctx context.Context, dir string, publishRoot *url.URL) (*Server, error)

New creates a new provider service. dir is the root of the files, pubishRoot is the URL the mux is mounted under.

func (*Server) GetCatalogue

GetCatalogue finds all the files that match the current authentication information, and converts them into a list of datasets.

func (*Server) GetDataset

GetDataset looks up a file by the given ID and returns it as a dataset.

func (*Server) Mux

func (s *Server) Mux() *http.ServeMux

Mux returns a mux that is ready to serve the files.

func (*Server) Ping

Ping sends back some basic info.

func (*Server) PublishDataset

PublishDataset publishes a dataset, in our context that means a file.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP is the handle function to serve the files. It will look up file offer and serve it if the token was in the header. Note that it will always return a 404 to make guessing the path harder.

func (*Server) UnpublishDataset

UnpublishDataset unpublishes a dataset.

Jump to

Keyboard shortcuts

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