Documentation
¶
Overview ¶
Package gist keeps backups in a secret GitHub gist, reached with a personal access token: each backup is a file of its own, named by backup.Name, in the one gist whose description is Description. A secret gist is unlisted, not private: anyone with its address can read the sealed files in it.
Index ¶
- Constants
- Variables
- type Gist
- func (g *Gist) Check(ctx context.Context) error
- func (g *Gist) Delete(ctx context.Context, name string) error
- func (g *Gist) Get(ctx context.Context, name string) ([]byte, error)
- func (g *Gist) List(ctx context.Context) ([]backup.Object, error)
- func (g *Gist) Put(ctx context.Context, name string, data []byte) error
Constants ¶
const Description = "SSHYard backup"
Description marks the gist SSHYard keeps its backups in.
Variables ¶
var ( // ErrToken reports an empty token, or one with spaces or line breaks. ErrToken = errors.New("gist: empty or malformed token") // ErrName reports a file name that is not a backup's. ErrName = errors.New("gist: not a backup file name") // ErrText reports data that is not UTF-8 text, which a gist cannot hold. ErrText = errors.New("gist: a gist holds text only") )
Functions ¶
This section is empty.
Types ¶
type Gist ¶
type Gist struct {
Token string
// ID is the gist's ID, "" until one is found or made.
ID string
// Bound is called, on the calling goroutine, with the ID once a gist
// is found or made, so that it can be saved. It may be nil.
Bound func(id string)
// API is the REST API's root; "" is GitHub's.
API string
// HTTP is the client requests go through; nil is backup.Client(nil).
HTTP *http.Client
}
Gist is the backup gist of the user a token belongs to.
func (*Gist) Check ¶
Check reaches the backup gist with the token, or, with none yet, the user's gists.