mirror of
https://github.com/octoleo/restic.git
synced 2024-11-23 05:12:10 +00:00
commit
d596712339
@ -169,7 +169,7 @@ func (arch *Archiver) SaveTreeJSON(item interface{}) (Blob, error) {
|
|||||||
// SaveFile stores the content of the file on the backend as a Blob by calling
|
// SaveFile stores the content of the file on the backend as a Blob by calling
|
||||||
// Save for each chunk.
|
// Save for each chunk.
|
||||||
func (arch *Archiver) SaveFile(p *Progress, node *Node) (Blobs, error) {
|
func (arch *Archiver) SaveFile(p *Progress, node *Node) (Blobs, error) {
|
||||||
file, err := os.Open(node.path)
|
file, err := node.OpenForReading()
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -11,6 +11,10 @@ import (
|
|||||||
"github.com/restic/restic/debug"
|
"github.com/restic/restic/debug"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (node *Node) OpenForReading() (*os.File, error) {
|
||||||
|
return os.Open(n.path)
|
||||||
|
}
|
||||||
|
|
||||||
func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
|
func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
|
||||||
stat, ok := fi.Sys().(*syscall.Stat_t)
|
stat, ok := fi.Sys().(*syscall.Stat_t)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -11,6 +11,10 @@ import (
|
|||||||
"github.com/restic/restic/debug"
|
"github.com/restic/restic/debug"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (node *Node) OpenForReading() (*os.File, error) {
|
||||||
|
return os.OpenFile(node.path, os.O_RDONLY|syscall.O_NOATIME, 0)
|
||||||
|
}
|
||||||
|
|
||||||
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
|
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
|
||||||
stat, ok := fi.Sys().(*syscall.Stat_t)
|
stat, ok := fi.Sys().(*syscall.Stat_t)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -2,6 +2,10 @@ package restic
|
|||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
|
func (node *Node) OpenForReading() (*os.File, error) {
|
||||||
|
return os.Open(n.path)
|
||||||
|
}
|
||||||
|
|
||||||
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
|
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user