resource

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

The resource package defines the api for a resource. It also provides a resource based on and input string. This is done via the scheme (the first part of the path provided). Schemes: - "gs://" will create a GCS resource - "file://" or "." or "/" or "\" (windows) will create a local file resource - "tcp://" or "http://" or "https://" or "ftp://" will create a network resource

Custom resources can be defined by implementing the Resource interface defined in this package. For example, you could define one for a zookeeper resource which sets a ZK watch.

Index

Constants

This section is empty.

Variables

View Source
var (
	UnknownTypeError    = errors.New("[gosprout] cannot derive resource type from path")
	NotImplementedError = errors.New("[gosprout] this is not implemented yet")
)

Functions

This section is empty.

Types

type Poller

type Poller interface {
	Poll(context.Context) (bool, error)
}

Poller will find if the resource data source has been updated since the last time the resource was accessed.

type Refresher

type Refresher interface {
	Refresh(context.Context, func(io.Reader), func(error))
}

Refreshers creates a reader from the underlying resource and calls the provided update func. The provided error handler will be used in case there is an issue.

type Resource

type Resource interface {
	Poller
	Refresher
}

The Resource needs to is a data source

func CreateResource

func CreateResource(path string) (Resource, error)

Directories

Path Synopsis
The gcs package implements a resource for Google Storage.
The gcs package implements a resource for Google Storage.
The net resource is not implemented yet.
The net resource is not implemented yet.

Jump to

Keyboard shortcuts

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