github.com/weaviate/weaviate@v1.24.6/usecases/backup/transport.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package backup
    13  
    14  import (
    15  	"context"
    16  	"time"
    17  
    18  	"github.com/weaviate/weaviate/entities/backup"
    19  )
    20  
    21  type client interface {
    22  	// CanCommit ask a node if it can participate in a distributed backup operation
    23  	CanCommit(ctx context.Context, node string, req *Request) (*CanCommitResponse, error)
    24  	// Commit tells a node to commit its part
    25  	Commit(ctx context.Context, node string, _ *StatusRequest) error
    26  	// Status returns the status of a backup operation of a specific node
    27  	Status(_ context.Context, node string, _ *StatusRequest) (*StatusResponse, error)
    28  	// Abort tells a node to abort the previous backup operation
    29  	Abort(_ context.Context, node string, _ *AbortRequest) error
    30  }
    31  
    32  type Request struct {
    33  	// Method is the backup operation (create, restore)
    34  	Method Op
    35  	// ID is the backup ID
    36  	ID string
    37  	// Backend specify on which backend to store backups (gcs, s3, ..)
    38  	Backend string
    39  
    40  	// NodeMapping specify node names replacement to be made on restore
    41  	NodeMapping map[string]string
    42  
    43  	// Classes is list of class which need to be backed up
    44  	Classes []string
    45  
    46  	// Duration
    47  	Duration time.Duration
    48  
    49  	// Compression is the compression configuration.
    50  	Compression
    51  }
    52  
    53  type CanCommitResponse struct {
    54  	// Method is the backup operation (create, restore)
    55  	Method Op
    56  	// ID is the backup ID
    57  	ID string
    58  	// Timeout for how long the promise might be hold
    59  	Timeout time.Duration
    60  	// Err error
    61  	Err string
    62  }
    63  
    64  type StatusRequest struct {
    65  	// Method is the backup operation (create, restore)
    66  	Method Op
    67  	// ID is the backup ID
    68  	ID string
    69  	// Backend specify on which backend to store backups (gcs, s3, ..)
    70  	Backend string
    71  }
    72  
    73  type StatusResponse struct {
    74  	// Method is the backup operation (create, restore)
    75  	Method Op
    76  	ID     string
    77  	Status backup.Status
    78  	Err    string
    79  }
    80  
    81  type (
    82  	AbortRequest  StatusRequest
    83  	AbortResponse StatusResponse
    84  )