storage

package
v0.0.0-...-20c3865 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserIndex = "users"
	UserType  = "user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobStore

type BlobStore interface {
	// Store saved the blob into the specified storage under the provided id
	// for a given repository.
	Store(Storage, *Repository, *blob.Blob) error
}

BlobStore determines from the Storage and Repository how the Blob should be indexer to a backing blobIndexer. In the process, it might alter the Blob, for example in order to apply transformations.

func NewSimpleBlobStore

func NewSimpleBlobStore() BlobStore

NewSimpleBlobStore creates a new simpleBlobStore.

func NewTransformingBlobStore

func NewTransformingBlobStore() BlobStore

NewTransformingBlobStore creates a new transformingBlobStore backed by a simpleBlobStore.

type Context

type Context struct {
	// Repository gives information about the repository concerned by the event
	// under transformation.
	Repository RepositoryInfo
}

Context is provided to transformations as a way to pass additional data to existing templates.

type EventSet

EventSet is a map of GitHub event types to subscribe to associated with their transformation.

func (EventSet) Contains

func (e EventSet) Contains(eventType string) bool

Contains returns whether the given eventType belongs in the event set.

type Repository

type Repository struct {
	// RepositoryConfig is the configuration defined for this particular
	// repository.
	config.RepositoryConfig

	// GivenName is the symbolic name for the repository as defined in the
	// configuration.
	GivenName string

	// EventSet is a map of subscribed GitHub events associated with the data
	// transformation to be applied.
	EventSet EventSet

	// PeriodicSync is the synchronization periodicity for this particular
	// repository.
	PeriodicSync config.PeriodicSync

	// Transformations is the collection of transformations instantiated for
	// this particular repository.
	//
	// It is likely that most of them are not repository specific (for example
	// if they never rely on the context information). However, this is a
	// difficult thing to anticipate, and is made even more complicated by the
	// fact that a given transformation can call another one through the
	// provided "apply_transformation" function.
	Transformations *transformation.Transformations
}

Repository represents a GitHub repository with its associated user given name and subscribed events set.

Data for a repository is stored in Elastic Search according to the following structure:

  • Events in a per-month 'givenName_user-repo_YYYY-MM' index
  • Current state in a single 'givenname_user-repo_snapshot' index

func NewRepository

func NewRepository(givenName string, repoConfig *config.RepositoryConfig, fullConfig *config.SerializedConfig) (*Repository, error)

func (*Repository) FullName

func (r *Repository) FullName() string

FullName returns a GitHub compatible identifier for the repository.

func (*Repository) IndexPrefix

func (r *Repository) IndexPrefix() string

IndexPrefix returns the string that prefixes all Elastic Search indices for this repository data.

func (*Repository) IsSubscribed

func (r *Repository) IsSubscribed(event string) bool

IsSubscribed returns whether we should subscribe for a particular GitHub event type for this repository.

func (*Repository) LiveIndex

func (r *Repository) LiveIndex() string

LiveIndex returns the current Elastic Search index appropriate to store this repository's events. This value changes over time.

func (*Repository) LiveIndexForTimestamp

func (r *Repository) LiveIndexForTimestamp(timestamp time.Time) string

LiveIndexForTimestamp returns the current Elastic Search index appropriate to store this repository's events with the specified timestamp.

func (*Repository) PrettyName

func (r *Repository) PrettyName() string

PrettyName returns a human readable identifier for the repository.

func (*Repository) SnapshotIndex

func (r *Repository) SnapshotIndex() string

SnapshotIndex returns the current Elastic Search index appropriate to store this repository's snapshot data (such as the latest state of each pull request and issue).

func (*Repository) StateIndex

func (r *Repository) StateIndex() string

StateIndex returns the current Elastic Search index appropriate to store this repository's items current state. This value changes over time.

func (*Repository) StateIndexForTimestamp

func (r *Repository) StateIndexForTimestamp(timestamp time.Time) string

StateIndexForTimestamp returns the Elastic Search index appropriate to store an object with the specified timestamp.

type RepositoryInfo

type RepositoryInfo interface {
	// FullName returns the GitHub repository full name, whic is in the form
	// "user/repo" (e.g., "icecrime/docker")
	FullName() string

	// PrettyName returns a vossibility specific string which identifies the
	// repository but also includes its given name (which has no existence on
	// GitHub).
	PrettyName() string
}

RepositoryInfo provides information about the repository to the executed templates.

type Storage

type Storage int

Storage is the target storage for an Index operation.

const (
	// StoreSnapshot corresponds to the non-expiring index (that is, the index
	// that always holds the latest version of all GitHub items). This index
	// only stores snapshotted data.
	StoreSnapshot Storage = iota

	// StoreCurrentState corresponds to the periocally rolling index (that is,
	// the index that gets archived and renewed at a regular interval). This
	// index only stores snapshotted data.
	StoreCurrentState

	// StoreLiveEvent corresponds to the rolling index of events.
	StoreLiveEvent
)

type UserData

type UserData struct {
	Login        string `json:"login"`
	Company      string `json:"company"`
	IsMaintainer bool   `json:"is_maintainer" toml:"is_maintainer"`
}

Jump to

Keyboard shortcuts

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