github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/appparts/types.go (about)

     1  /*
     2   * Copyright (c) 2021-present Sigma-Soft, Ltd.
     3   * @author: Nikolay Nikitin
     4   */
     5  
     6  package appparts
     7  
     8  import (
     9  	"github.com/voedger/voedger/pkg/appdef"
    10  	"github.com/voedger/voedger/pkg/istructs"
    11  )
    12  
    13  // ProcessorKind is a enumeration of processors.
    14  // moved here from pkg/cluster to avoid import cycle: appparts uses cluster.ProcessorKid, cluster uses appparts.IAppPartitions in c.cluster.AppDeploy
    15  type ProcessorKind uint8
    16  
    17  //go:generate stringer -type=ProcessorKind
    18  
    19  const (
    20  	ProcessorKind_Command ProcessorKind = iota
    21  	ProcessorKind_Query
    22  	ProcessorKind_Actualizer
    23  
    24  	ProcessorKind_Count
    25  )
    26  
    27  type AppDeploymentDescriptor struct {
    28  	// Number of partitions. Partitions IDs will be generated from 0 to NumParts-1
    29  	//
    30  	// NumParts should contain _total_ number of partitions, not only to deploy.
    31  	NumParts istructs.NumAppPartitions
    32  
    33  	// EnginePoolSize pools size for each processor kind
    34  	EnginePoolSize [ProcessorKind_Count]int
    35  
    36  	// total numer of AppWorkspaces
    37  	NumAppWorkspaces istructs.NumAppWorkspaces
    38  }
    39  
    40  func PoolSize(c, q, p int) [ProcessorKind_Count]int { return [ProcessorKind_Count]int{c, q, p} }
    41  
    42  // Describes built-in application.
    43  type BuiltInApp struct {
    44  	AppDeploymentDescriptor
    45  
    46  	Name istructs.AppQName
    47  
    48  	// Application definition will use to generate AppStructs
    49  	Def appdef.IAppDef
    50  }