Service - Unit Manager: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Overview =
= Overview =


Each unit is handled by a [[Service - Unit (handlers)]] service.
Each tracked unit is handled by a [[Service - Unit (handlers)]] service.


The Unit Manager service handles shared orchestration of the Unit Handler services.
The Unit Manager service handles shared orchestration of the Unit Handler services and the base unit objectType.


= Repository =
= Repository =


https://bitbucket.org/izara-market-products/izara-market-products-unit-manager
https://bitbucket.org/izara-supply-units/izara-supply-units-unit-manager


= DynamoDB tables =
= DynamoDB tables =


== [[Standard Config Table Per Service]] ==
== UnitRecord ==


=== Configuration tags ===
Records which Handler manages each unit


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
configKey: "SupplyGraphServiceName"
unitId
configTag: "SupplyGraphServiceName"
unitHandlerServiceNameTag
configValue: xxx // eg: "SupplyGraph"
}
}
</syntaxhighlight>
</syntaxhighlight>
* partition key: unitId
* sort key: (none)
= objectSchemas =


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
configKey: "UnitHandlerService"
objectType: "unit",
configTag: xxx // unitHandlerServiceNameTag, eg: "UnitStandard"|"UnitPacking", this is what is saved in each record
storageResources:{
configValue: {
"xxx":{
serviceName: xxx // eg: "UnitStandard", this is the actual deployed service name}
storageType: "graph",
}
graphServerTag: "xx",
}
}
},
fieldNames: {
unitId: {
type: "string",
            randomOnCreate: true
},
},
identifiers: [
{
fieldName: "unitId"
},
]
},
</syntaxhighlight>
</syntaxhighlight>


== UnitRecord ==
= relationshipSchemas =  


Records which Handler manages each unit
<syntaxhighlight lang="JavaScript">
[
  {
    "activeUnit": {
      fieldNames: {
        originTimestamp:{}
      },
      storageResources:{
"xxx":{
storageType: "graph",
graphServerTag: "xx",
}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
</syntaxhighlight>


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
[
unitId
  {
unitHandlerServiceNameTag
    "inactiveUnit": {
}
      fieldNames: {
        originTimestamp:{}
      },
      storageResources:{
"xxx":{
storageType: "graph",
graphServerTag: "xx",
}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
</syntaxhighlight>
</syntaxhighlight>


* partition key: unitId
* links to the user who currently owns the unit, depending on whether active or inactive
* sort key: (none)


= Graph database =
<syntaxhighlight lang="JavaScript">
[
  {
    "unitPreviouslyOwnedByUser": {
storageResources:{
"xxx":{
storageType: "graph",
graphServerTag: "xx",
}
},
fieldNames: {
"fromTimestamp": {
  type: "timestamp",
  requiredOnCreate: true,
},
"toTimestamp": {
  type: "timestamp",
  requiredOnCreate: true,
}
},     
links: [
{
  storageResourceTags: ["xxx"],
  from: {
objType: {
  serviceTag: "unitManager",
  objectType: "unit"
},
linkType: "many",
  },
  to: {
objType: {
  serviceTag: "user",
  objectType: "user"
},
linkType: "many",
  }
}
]
    }
  }
]
</syntaxhighlight>


== [[Service - Supply Graph]]==
* links to users who previously owned the unit
* method of creating this link will be similar to versionedData, creating a new activeUnit relationship at the same time as creating a new unitPreviouslyOwnedByUser relationship


=== Nodes ===
= Ownership =


<syntaxhighlight lang="JavaScript">
* Each Unit is owned by one user, who can transfer ownership to another user
{
* Owner can set user level permissions for other users to manage their units, like any other user owned object
nodeLabel: "{UnitSharedLib.UNIT_GRAPH_NODE_LABEL}", // stored in shared npm, shared by all unit Handlers
* New owner needs to accept ownership transfer for it to complete (in future could setup automatic acceptance configuration)
schema: {
* Existing permissions can transfer across, and need to be managed by new owner
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
unitId: {
identifier: true, //(random uuid)
},
unitHandlerServiceNameTag: {
immutable: true,
},
},
}
}
</syntaxhighlight>
* Unit Manager is responsible for this object type because shared by all Unit Handlers


= Working documents =
= Working documents =

Latest revision as of 22:42, 2 September 2025

Overview

Each tracked unit is handled by a Service - Unit (handlers) service.

The Unit Manager service handles shared orchestration of the Unit Handler services and the base unit objectType.

Repository

https://bitbucket.org/izara-supply-units/izara-supply-units-unit-manager

DynamoDB tables

UnitRecord

Records which Handler manages each unit

{
	unitId
	unitHandlerServiceNameTag
}
  • partition key: unitId
  • sort key: (none)

objectSchemas

{
	objectType: "unit",
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		unitId: {
			type: "string",
            randomOnCreate: true
		},
	},
	identifiers: [
		{
			fieldName: "unitId"
		},
	]
},

relationshipSchemas

[
  {
    "activeUnit": {
      fieldNames: {
        originTimestamp:{}
      },
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
[
  {
    "inactiveUnit": {
      fieldNames: {
        originTimestamp:{}
      },
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
  • links to the user who currently owns the unit, depending on whether active or inactive
[
  {
    "unitPreviouslyOwnedByUser": {
		storageResources:{
			"xxx":{
				storageType: "graph",
				graphServerTag: "xx",
			}
		},
		fieldNames: {
			"fromTimestamp": {
			  type: "timestamp",
			  requiredOnCreate: true,
			},
			"toTimestamp": {
			  type: "timestamp",
			  requiredOnCreate: true,
			}
		},      
		links: [
			{
			  storageResourceTags: ["xxx"],
			  from: {
				objType: {
				  serviceTag: "unitManager",
				  objectType: "unit"
				},
				linkType: "many",
			  },
			  to: {
				objType: {
				  serviceTag: "user",
				  objectType: "user"
				},
				linkType: "many",
			  }
			}
		]
    }
  }
]
  • links to users who previously owned the unit
  • method of creating this link will be similar to versionedData, creating a new activeUnit relationship at the same time as creating a new unitPreviouslyOwnedByUser relationship

Ownership

  • Each Unit is owned by one user, who can transfer ownership to another user
  • Owner can set user level permissions for other users to manage their units, like any other user owned object
  • New owner needs to accept ownership transfer for it to complete (in future could setup automatic acceptance configuration)
  • Existing permissions can transfer across, and need to be managed by new owner

Working documents

Unit Manager