github

package
v0.0.0-...-745d1e8 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2016 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const HourFormat = "2006-01-02-15"

Variables

This section is empty.

Functions

func DownloadArchive

func DownloadArchive(t time.Time) (io.ReadCloser, error)

func Is404

func Is404(err error) bool

func IsRateLimit

func IsRateLimit(err error) *github.Rate

Types

type CreateEvent

type CreateEvent struct {
	RefType string `json:"ref_type"`
}

type Event

type Event struct {
	CreatedAt github.Timestamp `json:"created_at"`
	Payload   json.RawMessage  `json:"payload"`
	Repo      struct {
		Name string `json:"name"`
	} `json:"repo"`
	Type string `json:"type"`
}

type ForkEvent

type ForkEvent struct {
	Forkee struct {
		FullName string `json:"full_name"`
	} `json:"forkee"`
}

type Repo

type Repo struct {
	Stars       int
	Parent      string
	LastUpdated time.Time
}

func (Repo) MarshalMsg

func (z Repo) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Repo) Msgsize

func (z Repo) Msgsize() (s int)

func (*Repo) UnmarshalMsg

func (z *Repo) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type StarTracker

type StarTracker struct {
	// contains filtered or unexported fields
}

StarTracker keeps track of how many stars a repository has. It is backed by a db on disk, goes to GitHub for never-seen-before, and it assumes it will be told about every WatchEvent ever since so that it can keep the number accurate without ever going to the network again.

A StarTracker is not safe to use by multiple goroutines at the same time, and it assumes WatchEvents and Gets are submited sequentially anyway. However, it is fully idempotent.

func NewStarTracker

func NewStarTracker(db *bolt.DB, gitHubToken string) *StarTracker

func (*StarTracker) CreateEvent

func (s *StarTracker) CreateEvent(name, parent string, created time.Time) error

func (*StarTracker) Expvar

func (s *StarTracker) Expvar() *expvar.Map

func (*StarTracker) Get

func (s *StarTracker) Get(name string) (stars int, parent string, err error)

func (*StarTracker) WatchEvent

func (s *StarTracker) WatchEvent(name string, created time.Time) error

type TimelineArchiveReader

type TimelineArchiveReader struct {
	// contains filtered or unexported fields
}

TimelineArchiveReader reads a .json.gz like those offered by githubarchive.org

func NewTimelineArchiveReader

func NewTimelineArchiveReader(r io.Reader) (*TimelineArchiveReader, error)

func (*TimelineArchiveReader) Close

func (t *TimelineArchiveReader) Close() error

func (*TimelineArchiveReader) Read

func (t *TimelineArchiveReader) Read(e *Event) error

Jump to

Keyboard shortcuts

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