restore

package
v1.1.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareDevices

func PrepareDevices(ctx context.Context, rs *RestoreStore, kv kvstore.KVStore, log logrus.FieldLogger) (devicesUpdated int64, err error)

PrepareDevices performs post-restoration device preparation: clear KV store, update device and enrollment request annotations, add awaiting-reconnection keys, and create a system restored event in the store.

Types

type RestoreStore

type RestoreStore struct {
	// contains filtered or unexported fields
}

RestoreStore provides the minimal set of database operations required by the post-restoration preparation logic. It wraps a *gorm.DB directly so the restore package does not depend on internal/store.Store.

func NewRestoreStore

func NewRestoreStore(db *gorm.DB) *RestoreStore

NewRestoreStore creates a RestoreStore backed by the given gorm connection.

func (*RestoreStore) CreateEvent

func (s *RestoreStore) CreateEvent(ctx context.Context, orgId uuid.UUID, resource *domain.Event) error

CreateEvent persists a domain event.

func (*RestoreStore) GetAllDeviceNames

func (s *RestoreStore) GetAllDeviceNames(ctx context.Context, orgId uuid.UUID) ([]string, error)

GetAllDeviceNames returns all device names for a given organization.

func (*RestoreStore) ListOrganizations

func (s *RestoreStore) ListOrganizations(ctx context.Context) ([]*orgmodel.Organization, error)

ListOrganizations returns all organizations (no filtering).

func (*RestoreStore) PrepareDevicesAfterRestore

func (s *RestoreStore) PrepareDevicesAfterRestore(ctx context.Context) (int64, error)

PrepareDevicesAfterRestore sets the awaitingReconnect annotation on all eligible devices, clears their lastSeen timestamps, and sets a status summary.

func (*RestoreStore) PrepareEnrollmentRequestsAfterRestore

func (s *RestoreStore) PrepareEnrollmentRequestsAfterRestore(ctx context.Context) (int64, error)

PrepareEnrollmentRequestsAfterRestore sets the awaitingReconnect annotation on all non-approved enrollment requests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL