libgin

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: BSD-3-Clause Imports: 17 Imported by: 2

Documentation

Overview

Package libgin provides functionality shared between the G-Node GIN services. These include: - GIN Web: The G-Node/GOGS fork (https://github.com/G-Node/gogs) - GIN DOI: The DOI registration service (https://github.com/G-Node/gin-doi) - GIN DEX: The indexing service for GIN (https://github.com/G-Node/gin-dex)

Index

Constants

View Source
const (
	SEARCH_MATCH = iota
	SEARCH_FUZZY
	SEARCH_WILDCARD
	SEARCH_QUERY
	SEARCH_SUGGEST
)

Variables

View Source
var UUIDMap = map[string]string{
	"INT/multielectrode_grasp":                   "f83565d148510fede8a277f660e1a419",
	"ajkumaraswamy/HB-PAC_disinhibitory_network": "1090f803258557299d287c4d44a541b2",
	"steffi/Kleineidam_et_al_2017":               "f53069de4c4921a3cfa8f17d55ef98bb",
	"Churan/Morris_et_al_Frontiers_2016":         "97bc1456d3f4bca2d945357b3ec92029",
	"fabee/efish_locking":                        "6953bbf0087ba444b2d549b759de4a06",
}

UUIDMap is a map between registered repositories and their UUIDs for datasets registered before the new UUID generation method was implemented. This map is required because the current method of computing UUIDs differs from the older method and this lookup is used to handle the old-method UUIDs.

Functions

func Decrypt

func Decrypt(key, ciphertext []byte) ([]byte, error)

Decrypt an AES encrypted array of bytes.

func DecryptString

func DecryptString(key []byte, encstring string) (string, error)

DecryptString decrypts an AES encrypted base64 string.

func DecryptURLString

func DecryptURLString(key []byte, encstring string) (string, error)

DecryptURLString decrypts an AES encrypted URL encoded base64 string.

func Encrypt

func Encrypt(key, plaintext []byte) ([]byte, error)

Encrypt an array of bytes with AES.

func EncryptString

func EncryptString(key []byte, plaintext string) (string, error)

EncryptString encrypts a string using AES and returns it in base64.

func EncryptURLString

func EncryptURLString(key []byte, plaintext string) (string, error)

EncryptURLString encrypts a string using AES and returns it in URL encoded base64.

func IsRegisteredDOI

func IsRegisteredDOI(doi string) bool

func MakeZip

func MakeZip(dest io.Writer, source ...string) error

MakeZip recursively writes all the files found under the provided sources to the dest io.Writer in ZIP format. Any directories listed in source are archived recursively. Empty directories are ignored.

func ReadConf

func ReadConf(key string) string

ReadConf returns the value of a configuration env variable. If the variable is not set, an empty string is returned (ignores any errors).

func ReadConfDefault

func ReadConfDefault(key, defval string) string

ReadConfDefault returns the value of a configuration env variable. If the variable is not set, the default is returned.

func RepoPathToUUID

func RepoPathToUUID(URI string) string

RepoPathToUUID computes a UUID from a repository path.

Types

type Author

type Author struct {
	FirstName   string
	LastName    string
	Affiliation string
	ID          string
}

func (*Author) GetValidID

func (c *Author) GetValidID() *NamedIdentifier

func (*Author) RenderAuthor

func (a *Author) RenderAuthor() string

type BlobSResult

type BlobSResult struct {
	Source    *IndexBlob  `json:"_source"`
	Score     float64     `json:"_score"`
	Highlight interface{} `json:"highlight"`
}

type CommitSResult

type CommitSResult struct {
	Source    *IndexCommit `json:"_source"`
	Score     float64      `json:"_score"`
	Highlight interface{}  `json:"highlight"`
}

type DOIRegInfo

type DOIRegInfo struct {
	Missing         []string
	DOI             string
	UUID            string
	FileName        string
	FileSize        string
	Title           string
	Authors         []Author
	Description     string
	Keywords        []string
	References      []Reference
	Funding         []string
	License         *License
	ResourceType    string
	DateTime        time.Time
	TemplateVersion string
}

DOIRegInfo holds all the metadata and information necessary for a DOI registration request.

func (*DOIRegInfo) GetCitation

func (c *DOIRegInfo) GetCitation() string

func (*DOIRegInfo) GetType

func (c *DOIRegInfo) GetType() string

func (*DOIRegInfo) ISODate added in v0.3.2

func (c *DOIRegInfo) ISODate() string

func (*DOIRegInfo) Year added in v0.3.2

func (c *DOIRegInfo) Year() string

type DOIRequestData

type DOIRequestData struct {
	Username   string
	Realname   string
	Repository string
	Email      string
}

DOIRequestData is used to transmit data from GIN to DOI when a registration request is triggered.

type IndexBlob

type IndexBlob struct {
	*gig.Blob
	GinRepoName  string
	GinRepoId    string
	FirstCommit  string
	Id           int64
	Oid          gig.SHA1
	IndexingTime time.Time
	Content      string
	Path         string
}

type IndexCommit

type IndexCommit struct {
	*gig.Commit
	GinRepoId    string
	Oid          gig.SHA1
	GinRepoName  string
	IndexingTime time.Time
}

type IndexRequest

type IndexRequest struct {
	UserID   int64
	RepoID   int64
	RepoPath string
}

type License

type License struct {
	Name string
	URL  string
}

type NamedIdentifier

type NamedIdentifier struct {
	URI    string
	Scheme string
	ID     string
}

type Reference

type Reference struct {
	Reftype  string
	Name     string
	Citation string
	ID       string
}

func (Reference) GetURL added in v0.3.2

func (ref Reference) GetURL() string

type SearchRequest

type SearchRequest struct {
	Keywords string
	SType    int
	RepoIDs  []int64
}

type SearchResults

type SearchResults struct {
	Blobs   []BlobSResult
	Commits []CommitSResult
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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