Service - Stage Manager

From Izara Wiki
Jump to navigation Jump to search

Overview

Each stage is handled by a Service - Stage (handlers) service.

The Stage Manager service handles shared orchestration of the Stage Handler services and the base stage objectType.

Stage change location is shared across all handler stage objTypes, whereas unitAdjustments are used by stageStandard so in separate service.

Repository

https://bitbucket.org/izara-supply-stages/izara-supply-stages-stage-manager

DynamoDB tables

StageRecord

Records which Handler manages each Stage

{
	stageId
	stageHandlerServiceNameTag
}
  • partition key: stageId
  • sort key: (none)

objectSchemas

{
	objectType: "stage",
    belongTo: { // maybe in future when add RBAC to eg stages can make adjustments a child of Stage or StageStandard, like DeliveryMethod RateTable
		serviceTag: "iii",
		objectType: "jjj"
	},
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		stageId: {
			type: "string",
            randomOnCreate: true
		},
		timingSetting: {
			type: "string", // "immediate"|"fixed"|"variable"
		},
		fixedSeconds: {
			type: "numeric", // if timingSetting="fixed" this is the fixed number of seconds the stage takes
		},
		defaultSeconds: {
			type: "numeric", // if timingSetting="variable" this is the default number of seconds the stage takes
		}
	},
	identifiers: [
		{
			fieldName: "stageId"
		},
	]
},
  • configuration of a stage
  • parent object for different stage handler
{
	objectType: "stageChangeLocation",
    belongTo: { // maybe in future when add RBAC to eg stages
		serviceTag: "iii",
		objectType: "jjj"
	},
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		stagechangeLocationId: {
			type: "string",
            randomOnCreate: true
		},
	},
	identifiers: [
		{
			fieldName: "stagechangeLocationId"
		},
	]
},
  • configuration of a location change performed by a stage
{
	objectType: "appliedStage",
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		appliedStageId: {
			type: "string",
            randomOnCreate: true
		},
		fromTime: {
			type: "timestamp",
		},		
		toTime: {
			type: "timestamp",
		},		
	},
	identifiers: [
		{
			fieldName: "appliedStageId"
		},
	]
},
  • Created each time a stage is applied

relationshipSchemas

[
  {
    "hasAppliedStage": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "stageManager",
              objectType: "appliedStage"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
[
  {
    "appliedStage": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "appliedStage"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stage"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • what stage config this applied stage comes from
[
  {
    "hasChangeLocation": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stage"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stageChangeLocation"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • links stage to a pair of from/to stageLocations
  • multiple pairs per stage allows for a stage to change the stageLocation according to the units current stageLocation
[
  {
    "changeFromLocation": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stageChangeLocation"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "supplyLocationManager",
              objectType: "supplyLocation"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
[
  {
    "changeToLocation": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stageChangeLocation"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "supplyLocationManager",
              objectType: "supplyLocation"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
  • When this stage is applied if the units location matches a stageChangeLocation's changeFromLocation, change to the changeToLocation
  • optional, if none set or none match, the stage does not change the unit's location

Working documents

Stage Manager