ricecore

package module
v0.0.0-...-48f22e6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2015 License: MIT Imports: 9 Imported by: 0

README

Ricecore

Build Status

A ground up rewrite of RiceDB using Golang. Rather than meld the backend into the client's functionality like the original project, ricecore will serve as a pure api which clients can easily utilize.

Documentation can be found here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeactivateCurrentRice

func DeactivateCurrentRice(prog string) (err error)

Deactivates the currently active rice for a program

func InitCore

func InitCore()

Initializes ricecore, setting global variables, etc.

Types

type Package

type Package struct {
	Name       string `json:"name"`
	Desc       string `json:"description"`
	Author     string `json:"author"`
	Screenshot string `json:"cover"`
	Program    string `json:"program"`
	URL        string `json:"upstream"`
}

A package object represents a package object which will be used for querys and uploads.

func CreatePackage

func CreatePackage(rice *Rice, desc string, author string, screenshot string, url string) (pack *Package, err error)

Creates a package from a rice and other data and stores the information as a json

func GetPackage

func GetPackage(rice *Rice) (pack *Package, err error)

Loads a package.json file for an existing rice and returns the struct

func (Package) Download

func (pack Package) Download() (rice *Rice, err error)

Downloads a package and returns the rice

func (Package) Upload

func (pack Package) Upload() (err error)

Uploads a package to the ricebe server

type QueryResult

type QueryResult []*Package

The result of a query - used for unmarshalling results

func QueryPackages

func QueryPackages(keyword string) (qRes *QueryResult, err error)

Querys the backend with the given keyword and returns an array of packages as a result

type Rice

type Rice struct {
	Name    string      `json:"name"`
	Program string      `json:"prog"`
	Root    string      `json:"root"`
	Files   []*RiceFile `json:"files"`
}

A rice struct represents a rice with its files and other basic info

func CreateRice

func CreateRice(name string, prog string, root string, files []*RiceFile) (rice *Rice, err error)

Creates a rice and stores the information as a json

func GetActiveRice

func GetActiveRice(prog string) (rice *Rice, err error)

Returns the currently active rice for a program

func GetRice

func GetRice(name string, prog string) (rice *Rice, err error)

Loads a rice.json file from an existing rice and returns the struct

func (Rice) Activate

func (rice Rice) Activate() (err error)

Activates a Rice by symlinking the files into the specified dirs

func (Rice) FirstInit

func (rice Rice) FirstInit() (err error)

Initializes a created local rice, extracting the files from the directory to the rdb dir. Should be used to intialize a rice the first time for a given prgoram.

func (Rice) LocalInit

func (rice Rice) LocalInit(riceLoc string) (err error)

func (Rice) Swap

func (rice Rice) Swap() (err error)

Swaps in a rice by deactivating the currently active rice and activating the given rice

func (Rice) Uninstall

func (rice Rice) Uninstall() (err error)

Uninstalls a rice for a program, deleting the symlinks and moving the files back to their original locations

type RiceFile

type RiceFile struct {
	Location string `json:"location"`
	File     string `json:"file"`
}

A ricefile struct is a file within a rice. It contains the file name and its respective location

Jump to

Keyboard shortcuts

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