corso/src/pkg/backup/identity/identity.go
ryanfkeepers 3d15a0d649 first pass on compliance with the reason
establishes behavior around using the reasoner interface
in a world where paths can contain multiple services.  Primarily
focused on ensuring the reasoner clearly guides maintainers
towards proper usage.
2023-08-15 13:29:14 -06:00

28 lines
1.1 KiB
Go

package identity
import "github.com/alcionai/corso/src/pkg/path"
// Reasoner describes the parts of the backup that make up its
// data identity: the tenant, protected resources, services, and
// categories which are held within the backup.
//
// Reasoner only recognizes the "primary" protected resource and
// service. IE: subservice resources and services are not recognized
// as part of the backup Reason.
type Reasoner interface {
Tenant() string
// ProtectedResource represents the Primary protected resource.
// IE: if a path or backup supports subservices, this value
// should only provide the first service's resource, and not the
// resource for any subservice.
ProtectedResource() string
// Service represents the Primary service.
// IE: if a path or backup supports subservices, this value
// should only provide the first service; not a subservice.
Service() path.ServiceType
Category() path.CategoryType
// SubtreePath returns the path prefix for data in existing backups that have
// parameters (tenant, protected resourced, etc) that match this Reasoner.
SubtreePath() (path.Path, error)
}