storages

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DiffChangeTemplate = `` /* 330-byte string literal not displayed */

----- diff change -----

View Source
const DiffChangeUpdateTemplate = `` /* 169-byte string literal not displayed */
View Source
const DiffTemplate = `` /* 241-byte string literal not displayed */

----- generate message section -----

View Source
const FuncBodyTemplate = "{{ .Symbol }} return {{ .Value }}"
View Source
const FuncBodyUpdateTemplate = "{{ .Symbol }} return {{ .Value }}  >>> {{ .ChangeValue }}"

Variables

View Source
var ActionFunc = MigrateActionFunc{
	CreateFunc: supabase.CreateBucket,
	UpdateFunc: supabase.UpdateBucket,
	DeleteFunc: supabase.DeleteBucket,
}
View Source
var Logger hclog.Logger = logger.HcLog().Named("resource.storages")

Functions

func BuildGenerateStorageInput

func BuildGenerateStorageInput(storages []objects.Bucket, policies objects.Policies) []*generator.GenerateStorageInput

func Compare

func Compare(source []objects.Bucket, target []objects.Bucket) error

func GenerateDiffChangeMessage

func GenerateDiffChangeMessage(newData []string, updateData []string, deleteData []string) (string, error)

func GenerateDiffChangeUpdateMessage

func GenerateDiffChangeUpdateMessage(name string, item MigrateItem) (string, error)

func GenerateDiffMessage

func GenerateDiffMessage(storageName string, diffType DiffType, updateType objects.UpdateBucketType, value string, changeValue string) (string, error)

func GetDiffChangeMessage

func GetDiffChangeMessage(items []MigrateItem) string

func GetNewCountData

func GetNewCountData(cloudData []objects.Bucket, localData state.ExtractStorageResult) int

func Migrate

func Migrate(config *raiden.Config, storages []MigrateItem, stateChan chan any, actions MigrateActionFunc) []error

func PrintDiff

func PrintDiff(diffData CompareDiffResult)

func PrintDiffResult

func PrintDiffResult(diffResult []CompareDiffResult) error

Types

type CompareDiffResult

type CompareDiffResult struct {
	Name           string
	SourceResource objects.Bucket
	TargetResource objects.Bucket
	DiffItems      objects.UpdateBucketParam
	IsConflict     bool
}

func CompareItem

func CompareItem(source, target objects.Bucket) (diffResult CompareDiffResult)

func CompareList

func CompareList(sourceStorage, targetStorage []objects.Bucket) (diffResult []CompareDiffResult, err error)

type DiffType

type DiffType string

----- Print diff section -----

const (
	DiffTypeCreate DiffType = "create"
	DiffTypeUpdate DiffType = "update"
	DiffTypeDelete DiffType = "delete"
)

type MigrateItem

func BuildMigrateData

func BuildMigrateData(extractedLocalData state.ExtractStorageResult, supabaseData []objects.Bucket) (migrateData []MigrateItem, err error)

func BuildMigrateItem

func BuildMigrateItem(supabaseData []objects.Bucket, localData []objects.Bucket) (migratedData []MigrateItem, err error)

Jump to

Keyboard shortcuts

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