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 ¶
- type Server
- func (s *Server) GetCatalogue(ctx context.Context, req *providerv1alpha1.GetCatalogueRequest) (*providerv1alpha1.GetCatalogueResponse, error)
- func (s *Server) GetDataset(ctx context.Context, req *providerv1alpha1.GetDatasetRequest) (*providerv1alpha1.GetDatasetResponse, error)
- func (s *Server) Mux() *http.ServeMux
- func (s *Server) Ping(ctx context.Context, req *providerv1alpha1.PingRequest) (*providerv1alpha1.PingResponse, error)
- func (s *Server) PublishDataset(ctx context.Context, req *providerv1alpha1.PublishDatasetRequest) (*providerv1alpha1.PublishDatasetResponse, error)
- func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (s *Server) UnpublishDataset(ctx context.Context, req *providerv1alpha1.UnpublishDatasetRequest) (*providerv1alpha1.UnpublishDatasetResponse, error)
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 ¶
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 ¶
func (s *Server) GetCatalogue( ctx context.Context, req *providerv1alpha1.GetCatalogueRequest, ) (*providerv1alpha1.GetCatalogueResponse, error)
GetCatalogue finds all the files that match the current authentication information, and converts them into a list of datasets.
func (*Server) GetDataset ¶
func (s *Server) GetDataset( ctx context.Context, req *providerv1alpha1.GetDatasetRequest, ) (*providerv1alpha1.GetDatasetResponse, error)
GetDataset looks up a file by the given ID and returns it as a dataset.
func (*Server) Ping ¶
func (s *Server) Ping(ctx context.Context, req *providerv1alpha1.PingRequest) (*providerv1alpha1.PingResponse, error)
Ping sends back some basic info.
func (*Server) PublishDataset ¶
func (s *Server) PublishDataset( ctx context.Context, req *providerv1alpha1.PublishDatasetRequest, ) (*providerv1alpha1.PublishDatasetResponse, error)
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 ¶
func (s *Server) UnpublishDataset( ctx context.Context, req *providerv1alpha1.UnpublishDatasetRequest, ) (*providerv1alpha1.UnpublishDatasetResponse, error)
UnpublishDataset unpublishes a dataset.