source

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 16

Documentation

Overview

Package source handles the loading of YANG files generally from the disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacher

type Cacher interface {
	WriteToCache(resourceId string, ext string, copy io.Reader) error
	ReadFromCache(resourceId string, ext string) (io.Reader, error)
}

Cacher implementations manage cached resources

func DirCache

func DirCache(root string) Cacher

DirCache will cache yang files into local file directory

type Opener

type Opener func(src string, ext string) (io.Reader, error)

Opener will find yang files (resources) abstracting away where or how

func Any

func Any(s ...Opener) Opener

Any will sequentially look in any of these openers for the particular resource

func Cached

func Cached(src Opener, backup Cacher) Opener

Backup keeps a copy of every reasource that

func Dir

func Dir(root string) Opener

Dir will simply find yang files in a directory

func EmbedDir

func EmbedDir(fs embed.FS, root string) Opener

EmbedDir will find a yang file in an embedded file system because Embed doesn't support symlinks, EmbedDir also looks for version specific files of yang with a pattern of <resourceId>@<version><ext>, e.g. ietf-inet-types@2013-07-15.yang

func Named

func Named(name string, r io.Reader) Opener

Named - useful when you have a single yang file by name

func Path

func Path(path string) Opener

Path looks in a series of directories separated by ':'. Example ./foo:./bar

Jump to

Keyboard shortcuts

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