component: Add 'Snapshottable' component
This commit is contained in:
parent
1dac09bc03
commit
b6c36b5488
7 changed files with 28 additions and 13 deletions
|
|
@ -10,7 +10,7 @@ import (
|
|||
func (ts *Triplestore) BackupName() string { return "triplestore" }
|
||||
|
||||
// Backup makes a backup of all Triplestore repositories databases into the path dest.
|
||||
func (ts *Triplestore) Backup(context component.BackupContext) error {
|
||||
func (ts *Triplestore) Backup(context component.StagingContext) error {
|
||||
|
||||
// list all the directories
|
||||
repos, err := ts.listRepositories()
|
||||
|
|
@ -22,7 +22,7 @@ func (ts *Triplestore) Backup(context component.BackupContext) error {
|
|||
return context.AddDirectory("", func() error {
|
||||
for _, repo := range repos {
|
||||
if err := context.AddFile(repo.ID+".nq", func(file io.Writer) error {
|
||||
_, err := ts.Snapshot(file, repo.ID)
|
||||
_, err := ts.SnapshotDB(file, repo.ID)
|
||||
return err
|
||||
}); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ func (ts Triplestore) PurgeRepo(repo string) error {
|
|||
|
||||
var errTSBackupWrongStatusCode = errors.New("Distillery.Backup: Wrong status code")
|
||||
|
||||
// Snapshot snapshots the provided repository into dst
|
||||
func (ts Triplestore) Snapshot(dst io.Writer, repo string) (int64, error) {
|
||||
// SnapshotDB snapshots the provided repository into dst
|
||||
func (ts Triplestore) SnapshotDB(dst io.Writer, repo string) (int64, error) {
|
||||
res, err := ts.OpenRaw("GET", "/repositories/"+repo+"/statements?infer=false", nil, "", "application/n-quads")
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue