github.com/weaviate/weaviate@v1.24.6/usecases/schema/migrate/migrator.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 migrate provides a simple composer tool, which implements the
    13  // Migrator interface and can take in any number of migrators which themselves
    14  // have to implement the interface
    15  package migrate
    16  
    17  import (
    18  	"context"
    19  
    20  	"github.com/weaviate/weaviate/entities/models"
    21  	"github.com/weaviate/weaviate/entities/schema"
    22  	"github.com/weaviate/weaviate/usecases/sharding"
    23  )
    24  
    25  type CreateTenantPayload struct {
    26  	Name   string
    27  	Status string
    28  }
    29  
    30  type UpdateTenantPayload struct {
    31  	Name   string
    32  	Status string
    33  }
    34  
    35  // Migrator represents both the input and output interface of the Composer
    36  type Migrator interface {
    37  	AddClass(ctx context.Context, class *models.Class, shardingState *sharding.State) error
    38  	DropClass(ctx context.Context, className string) error
    39  	UpdateClass(ctx context.Context, className string,
    40  		newClassName *string) error
    41  	GetShardsQueueSize(ctx context.Context, className, tenant string) (map[string]int64, error)
    42  	GetShardsStatus(ctx context.Context, className, tenant string) (map[string]string, error)
    43  	UpdateShardStatus(ctx context.Context, className, shardName, targetStatus string) error
    44  	AddProperty(ctx context.Context, className string,
    45  		prop *models.Property) error
    46  	UpdateProperty(ctx context.Context, className string,
    47  		propName string, newName *string) error
    48  
    49  	NewTenants(ctx context.Context, class *models.Class, creates []*CreateTenantPayload) (commit func(success bool), err error)
    50  	UpdateTenants(ctx context.Context, class *models.Class, updates []*UpdateTenantPayload) (commit func(success bool), err error)
    51  	DeleteTenants(ctx context.Context, class *models.Class, tenants []string) (commit func(success bool), err error)
    52  
    53  	ValidateVectorIndexConfigUpdate(ctx context.Context,
    54  		old, updated schema.VectorIndexConfig) error
    55  	UpdateVectorIndexConfig(ctx context.Context, className string,
    56  		updated schema.VectorIndexConfig) error
    57  	ValidateVectorIndexConfigsUpdate(ctx context.Context,
    58  		old, updated map[string]schema.VectorIndexConfig) error
    59  	UpdateVectorIndexConfigs(ctx context.Context, className string,
    60  		updated map[string]schema.VectorIndexConfig) error
    61  	ValidateInvertedIndexConfigUpdate(ctx context.Context,
    62  		old, updated *models.InvertedIndexConfig) error
    63  	UpdateInvertedIndexConfig(ctx context.Context, className string,
    64  		updated *models.InvertedIndexConfig) error
    65  	RecalculateVectorDimensions(ctx context.Context) error
    66  	RecountProperties(ctx context.Context) error
    67  	InvertedReindex(ctx context.Context, taskNames ...string) error
    68  	AdjustFilterablePropSettings(ctx context.Context) error
    69  }