Documentation
¶
Index ¶
- type ChangeSource
- type Option
- func WithAccountEmail(email string) Option
- func WithCredsJSON(data []byte) Option
- func WithCredsPath(path string) Option
- func WithCredsRef(ref string) Option
- func WithDriveID(id string) Option
- func WithDriveName(name string) Option
- func WithDriveService(srv *drive.Service) Option
- func WithExcludePatterns(patterns []string) Option
- func WithHTTPClient(client *http.Client) Option
- func WithLogger(w io.Writer) Option
- func WithResolver(r *secretref.Resolver) Option
- func WithRootFolderID(id string) Option
- func WithRootPath(path string) Option
- func WithSkipNativeFiles() Option
- func WithTokenPath(path string) Option
- func WithTokenRef(ref string) Option
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeSource ¶
type ChangeSource struct {
Source
}
ChangeSource is an IncrementalSource backed by the Google Drive Changes API. It embeds Source to reuse authentication, full Walk, GetFileStream, and metadata conversion.
func NewChangeSource ¶
func NewChangeSource(ctx context.Context, opts ...Option) (*ChangeSource, error)
func (*ChangeSource) GetStartPageToken ¶
func (s *ChangeSource) GetStartPageToken() (string, error)
GetStartPageToken returns the token representing the current head of the Google Drive change stream.
func (*ChangeSource) Info ¶
func (s *ChangeSource) Info() source.SourceInfo
func (*ChangeSource) WalkChanges ¶
func (s *ChangeSource) WalkChanges(ctx context.Context, token string, callback func(source.FileChange) error) (string, error)
WalkChanges iterates over all changes since the given page token. Folder changes are emitted before file changes so that the engine can resolve parent references incrementally.
type Option ¶
type Option func(*gDriveOptions)
Option configures a Google Drive source.
func WithAccountEmail ¶
WithAccountEmail explicitly sets the account email instead of calling the API.
func WithCredsJSON ¶
WithCredsJSON provides credentials as raw JSON bytes (inline). Supports both OAuth-client and service-account credential formats. This mirrors rclone's service_account_credentials option.
func WithCredsPath ¶
WithCredsPath sets the path to the credentials JSON file. If empty, uses the built-in OAuth client.
func WithCredsRef ¶
WithCredsRef sets the secret reference to the credentials JSON.
func WithDriveID ¶
WithDriveID sets the shared drive ID. If empty, defaults to "My Drive".
func WithDriveName ¶
WithDriveName sets the shared drive name to use. It will be resolved to a Drive ID.
func WithDriveService ¶
WithDriveService injects a fully-constructed *drive.Service. When set, all credential/token options are ignored — the caller is responsible for scopes, token refresh, etc.
func WithExcludePatterns ¶
WithExcludePatterns sets the patterns used to exclude files and folders.
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client for OAuth.
func WithLogger ¶
WithLogger sends this source's debug output to w.
Sources are constructed independently of a client, so a client's sink cannot reach them; this is how a caller supplies one (RFC 0022 §8).
func WithResolver ¶
WithResolver sets the secret resolver for ref-based auth.
func WithRootFolderID ¶
WithRootFolderID sets the root folder ID directly (for client API).
func WithRootPath ¶
WithRootPath sets the path to the root folder. This is resolved to a folder ID during initialization.
func WithSkipNativeFiles ¶
func WithSkipNativeFiles() Option
WithSkipNativeFiles excludes Google-native files (Docs, Sheets, Slides, etc.) from the backup. They will not appear in the snapshot at all.
func WithTokenPath ¶
WithTokenPath sets the path where the OAuth token is cached.
func WithTokenRef ¶
WithTokenRef sets the secret reference where the OAuth token is cached.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source implements Source for Google Drive. By default it backs up the entire "My Drive" root. Set DriveID in SourceConfig to back up a shared drive instead, and/or set RootFolderID to restrict to a specific folder within the selected drive.
func (*Source) GetFileStream ¶
func (s *Source) GetFileStream(fileID string) (io.ReadCloser, error)
func (*Source) Info ¶
func (s *Source) Info() source.SourceInfo