library

package
v0.0.0-...-178a051 Latest Latest
Warning

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

Go to latest
Published: May 5, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package library is a package that keeps track of resources available to a user. A library consists of resources that a peer can offer, and resources that a peer has received.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignRandomIDs

func AssignRandomIDs(slice []*Resource) error

AssignRandomIDs takes a slice of resources, and assigns each a random ID.

Types

type Resource

type Resource struct {
	Name        string `json:"name"`        //name of the resource (cats.jpg)
	Description string `json:"description"` //short description of the resource
	Location    string `json:"location"`    //TODO make this a file type
	MimeType    string `json:"mimetype"`
	// contains filtered or unexported fields
}

Resource holds information about files a peer can share.

func CreateResourceFromJSON

func CreateResourceFromJSON(buf []byte) (*Resource, error)

CreateResourceFromJSON take a string representation of json data, and creates a Resource from it.

func LoadResourcesFrom

func LoadResourcesFrom(path string) ([]*Resource, error)

LoadResourcesFrom takes a path to a file that contains JSON descriptions of resources. This function will create a slice of pointers to resources.

Jump to

Keyboard shortcuts

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