github.com/weaviate/weaviate@v1.24.6/adapters/handlers/graphql/local/get/replication.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 get
    13  
    14  import (
    15  	"fmt"
    16  
    17  	"github.com/tailor-inc/graphql"
    18  	"github.com/weaviate/weaviate/adapters/handlers/graphql/descriptions"
    19  	"github.com/weaviate/weaviate/entities/models"
    20  	"github.com/weaviate/weaviate/usecases/replica"
    21  )
    22  
    23  func replicationEnabled(class *models.Class) bool {
    24  	return class.ReplicationConfig != nil && class.ReplicationConfig.Factor > 1
    25  }
    26  
    27  func consistencyLevelArgument(class *models.Class) *graphql.ArgumentConfig {
    28  	return &graphql.ArgumentConfig{
    29  		Description: descriptions.ConsistencyLevel,
    30  		Type: graphql.NewEnum(graphql.EnumConfig{
    31  			Name: fmt.Sprintf("%sConsistencyLevelEnum", class.Class),
    32  			Values: graphql.EnumValueConfigMap{
    33  				string(replica.One):    &graphql.EnumValueConfig{},
    34  				string(replica.Quorum): &graphql.EnumValueConfig{},
    35  				string(replica.All):    &graphql.EnumValueConfig{},
    36  			},
    37  		}),
    38  	}
    39  }