Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddNode = &graphql.Field{ Type: graphql.Boolean, Description: "Add new node to the cluster", Args: graphql.FieldConfigArgument{ "nodeID": &graphql.ArgumentConfig{ Description: "Node ID", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, "address": &graphql.ArgumentConfig{ Description: "Raft address of the node", Type: graphql.NewNonNull(graphql.String), }, "configChangeIndex": &graphql.ArgumentConfig{ Description: "Config change index", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { nodeID := p.Args["nodeID"].(*kind.UInt64) address := p.Args["address"].(string) configChangeIndex := p.Args["configChangeIndex"].(*kind.UInt64) nodeAdmin, ok := p.Source.(*flamed.NodeAdmin) if !ok { return nil, nil } err := nodeAdmin.AddNode(nodeID.Value(), address, configChangeIndex.Value()) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return true, nil }, }
View Source
var AddObserver = &graphql.Field{ Type: graphql.Boolean, Description: "Add new node to the cluster", Args: graphql.FieldConfigArgument{ "nodeID": &graphql.ArgumentConfig{ Description: "Node ID", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, "address": &graphql.ArgumentConfig{ Description: "Raft address of the node", Type: graphql.NewNonNull(graphql.String), }, "configChangeIndex": &graphql.ArgumentConfig{ Description: "Config change index", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { nodeID := p.Args["nodeID"].(*kind.UInt64) address := p.Args["address"].(string) configChangeIndex := p.Args["configChangeIndex"].(*kind.UInt64) nodeAdmin, ok := p.Source.(*flamed.NodeAdmin) if !ok { return nil, nil } err := nodeAdmin.AddObserver(nodeID.Value(), address, configChangeIndex.Value()) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return true, nil }, }
View Source
var AddWitness = &graphql.Field{ Type: graphql.Boolean, Description: "Add new node to the cluster", Args: graphql.FieldConfigArgument{ "nodeID": &graphql.ArgumentConfig{ Description: "Node ID", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, "address": &graphql.ArgumentConfig{ Description: "Raft address of the node", Type: graphql.NewNonNull(graphql.String), }, "configChangeIndex": &graphql.ArgumentConfig{ Description: "Config change index", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { nodeID := p.Args["nodeID"].(*kind.UInt64) address := p.Args["address"].(string) configChangeIndex := p.Args["configChangeIndex"].(*kind.UInt64) nodeAdmin, ok := p.Source.(*flamed.NodeAdmin) if !ok { return nil, nil } err := nodeAdmin.AddWitness(nodeID.Value(), address, configChangeIndex.Value()) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return true, nil }, }
View Source
var BuildIndex = &graphql.Field{ Type: graphql.Boolean, Description: "Build or rebuild full state database index", Resolve: func(p graphql.ResolveParams) (interface{}, error) { nodeAdmin, ok := p.Source.(*flamed.NodeAdmin) if !ok { return false, nil } nodeAdmin.BuildIndex() return true, nil }, }
View Source
var BuildIndexByNamespace = &graphql.Field{ Type: graphql.Boolean, Description: "Build or rebuild state database index by namespace", Args: graphql.FieldConfigArgument{ "namespace": &graphql.ArgumentConfig{ Description: "Namespace", Type: graphql.NewNonNull(graphql.String), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { namespace := p.Args["namespace"].(string) namespaceBytes := []byte(namespace) if !utility.IsNamespaceValid(namespaceBytes) { return nil, gqlerrors.NewFormattedError(x.ErrInvalidNamespace.Error()) } nodeAdmin, ok := p.Source.(*flamed.NodeAdmin) if !ok { return false, nil } nodeAdmin.BuildIndexByNamespace(namespaceBytes) return true, nil }, }
View Source
var DeleteNode = &graphql.Field{ Type: graphql.Boolean, Description: "Add new node to the cluster", Args: graphql.FieldConfigArgument{ "nodeID": &graphql.ArgumentConfig{ Description: "Node ID", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, "configChangeIndex": &graphql.ArgumentConfig{ Description: "Config change index", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { nodeID := p.Args["nodeID"].(*kind.UInt64) configChangeIndex := p.Args["configChangeIndex"].(*kind.UInt64) nodeAdmin, ok := p.Source.(*flamed.NodeAdmin) if !ok { return nil, nil } err := nodeAdmin.DeleteNode(nodeID.Value(), configChangeIndex.Value()) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return true, nil }, }
View Source
var GQLNodeAdminMutatorType = graphql.NewObject(graphql.ObjectConfig{ Name: "NodeAdminMutator", Description: "`NodeAdminMutator` gives the ability to perform administrative tasks of the cluster", Fields: graphql.Fields{ "addNode": AddNode, "addObserver": AddObserver, "addWitness": AddWitness, "deleteNode": DeleteNode, "runStorageGC": RunStorageGC, "buildIndex": BuildIndex, "buildIndexByNamespace": BuildIndexByNamespace, "requestSnapshot": RequestSnapshot, }, })
View Source
var RequestSnapshot = &graphql.Field{ Type: kind.GQLUInt64Type, Description: "Add new node to the cluster", Args: graphql.FieldConfigArgument{ "compactionOverhead": &graphql.ArgumentConfig{ Description: "Compaction overhead", Type: graphql.NewNonNull(kind.GQLUInt64Type), }, "exported": &graphql.ArgumentConfig{ Description: "Will the snapshot be exported?", Type: graphql.NewNonNull(graphql.Boolean), }, "overrideCompactionOverhead": &graphql.ArgumentConfig{ Description: "Compaction overhead override flag", Type: graphql.NewNonNull(graphql.Boolean), }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { compactionOverhead := p.Args["compactionOverhead"].(*kind.UInt64) exported := p.Args["exported"].(bool) overrideCompactionOverhead := p.Args["overrideCompactionOverhead"].(bool) exportPath := viper.GetString(constant.StoragePath) + "/snapshot" utility.MkPath(exportPath) nodeAdmin, ok := p.Source.(*flamed.NodeAdmin) if !ok { return nil, nil } n, err := nodeAdmin.RequestSnapshot(compactionOverhead.Value(), exportPath, exported, overrideCompactionOverhead) if err != nil { return nil, gqlerrors.NewFormattedError(err.Error()) } return kind.NewUInt64FromUInt64(n), nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.