Code Monkey home page Code Monkey logo

cardant's Introduction

cardant

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.cardant

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

cardant's People

Contributors

io7m avatar dependabot[bot] avatar

Watchers

 avatar  avatar

cardant's Issues

Reimplement auditing

Now that most of the database refactoring is done, it's now necessary to ensure that all operations write something to the audit log.

Location paths

Location summaries should return the path to the location... "Office/Rack1/Machine1" and so on. This can't be done on the client side efficiently, but the database should have no trouble with it.

Location matching seems broken

cardant=# select * from item_locations where item_location = 'b32f8124-0d3c-4d9a-bcda-9d9c1e418959';
          item_location_item          |            item_location             | item_location_count | item_location_serial 
--------------------------------------+--------------------------------------+---------------------+----------------------
 0adb8f6a-ed35-479d-baf9-2e2f9a50b622 | b32f8124-0d3c-4d9a-bcda-9d9c1e418959 |                   1 | (null)
 471f4b03-9229-4d6f-8729-950a6aa9b257 | b32f8124-0d3c-4d9a-bcda-9d9c1e418959 |                   2 | (null)
 b26bb97e-e51a-4365-b2dc-470456f01abe | b32f8124-0d3c-4d9a-bcda-9d9c1e418959 |                   1 | (null)
 d5f790ec-0f4f-4533-b7f9-9c8f7f430a2e | b32f8124-0d3c-4d9a-bcda-9d9c1e418959 |                   1 | S4CZNF0MA39152A
 d61eac56-eff6-4777-bb73-78e32f432098 | b32f8124-0d3c-4d9a-bcda-9d9c1e418959 |                   1 | (null)
(5 rows)
[cardant]$ item-search-begin --location-match '[with-location-exact b32f8124-0d3c-4d9a-bcda-9d9c1e418959]'
Search results: Page 1 of 1
┌──────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Item ID                              │ Description                                                                                                                                 │
├──────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ b26bb97e-e51a-4365-b2dc-470456f01abe │ NVIDIA GeForce GTX 1660 Ti                                                                                                                  │
└──────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Location types and metadata

Locations need more metadata. At a minimum:

  • A location type such as "storage", "deployed device", etc.
  • An image attachment

Add a transaction endpoint

The endpoint works the same way as /command except that it accepts a list of commands and executes them in a single transaction.

Weird location-put behaviour if ID isn't specified

[cardant]$ location-put --id 0b3a0e83-3e94-411f-b01e-ed042614ca84 --name House
┌───────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Attribute     │ Value                                                                                                                                                        │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Location ID   │ 0b3a0e83-3e94-411f-b01e-ed042614ca84                                                                                                                         │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Name          │ House                                                                                                                                                        │
├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Parent        │ None                                                                                                                                                         │
└───────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
[cardant]$ location-put --parent 0b3a0e83-3e94-411f-b01e-ed042614ca84 --name Windows01
com.io7m.cardant.model.CAValidityException: A location's parent cannot equal itself
	at [email protected]/com.io7m.cardant.model.CALocation.lambda$new$0(CALocation.java:65)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at [email protected]/com.io7m.cardant.model.CALocation.<init>(CALocation.java:63)
	at [email protected]/com.io7m.cardant.shell.internal.CAShellCmdLocationPut.modifyExistingLocation(CAShellCmdLocationPut.java:192)
	at [email protected]/com.io7m.cardant.shell.internal.CAShellCmdLocationPut.onExecute(CAShellCmdLocationPut.java:158)
	at [email protected]/com.io7m.cardant.shell.internal.CAShell.runForOneLine(CAShell.java:250)
	at [email protected]/com.io7m.cardant.shell.internal.CAShell.run(CAShell.java:146)
	at [email protected]/com.io7m.cardant.main.internal.CMCmdShell.onExecute(CMCmdShell.java:120)
	at [email protected]/com.io7m.quarrel.core.internal.QCommandContext.execute(QCommandContext.java:207)
	at [email protected]/com.io7m.quarrel.core.QApplicationType.run(QApplicationType.java:94)
	at [email protected]/com.io7m.cardant.main.CAMain.run(CAMain.java:153)
	at [email protected]/com.io7m.cardant.main.CAMain.mainExitless(CAMain.java:128)
	at [email protected]/com.io7m.cardant.main.CAMain.main(CAMain.java:113)

type-scalar-search-begin seems broken

There's a type in the database:

cardant=# select * from metadata_types_scalar;
-[ RECORD 1 ]----------+------------
mts_id                 | 2
mts_name               | text
mts_description        | 
mts_description_search | 
mts_base_type          | SCALAR_TEXT
mts_integral_lower     | (null)
mts_integral_upper     | (null)
mts_text_pattern       | .*
mts_time_lower         | (null)
mts_time_upper         | (null)
mts_money_lower        | (null)
mts_money_upper        | (null)
mts_real_lower         | (null)
mts_real_upper         | (null)

But the shell says:

[cardant]$ type-scalar-search-begin --query text
Search results: Page 1 of 1
[cardant]$ type-scalar-search-begin
Search results: Page 1 of 1

Garbage collection of deleted items and locations

Items and locations can be marked as deleted. In the case of locations, the location has to satisfy various conditions to be marked, such as having no items, and no non-deleted children.

A maintenance task should now be created to actually delete the database objects associated with them after a given time-since-deletion threshold has been reached.

Owner role must have been granted ADMIN on worker role

Same problem as io7m-com/idstore#153.

Detail: To change another role's password, the current user must have the CREATEROLE attribute and the ADMIN option on the role.
cardant=# GRANT cardant_read_only TO cardant_owner WITH ADMIN TRUE;
GRANT ROLE
Time: 7.732 ms
cardant=# GRANT cardant TO cardant_owner WITH ADMIN TRUE;
GRANT ROLE
Time: 8.552 ms

Refactor searches

Northpike has a much more flexible search system based on exact, fuzzy, and set comparisons.

Type assignment handler fails to set user ID

Jan 08 11:19:39 services02 podman[1710254]: cardant: WARN: io.helidon.webserver.http.DirectHandlers: Internal server error
Jan 08 11:19:39 services02 podman[1710254]: io.helidon.http.RequestException: No user ID has been set.
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.http.RequestException$Builder.build(RequestException.java:139)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.unhandledError(ErrorHandlers.java:202)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.lambda$handleError$1(ErrorHandlers.java:182)
Jan 08 11:19:39 services02 podman[1710254]:         at java.base/java.util.Optional.ifPresentOrElse(Unknown Source)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.handleError(ErrorHandlers.java:181)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:118)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:121)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.http.CAHTTPRequestTimeFilter.filter(CAHTTPRequestTimeFilter.java:69)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.Filters.executeFilters(Filters.java:87)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.Filters.lambda$filter$0(Filters.java:83)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.Filters.filter(Filters.java:83)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.HttpRouting.route(HttpRouting.java:109)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http1.Http1Connection.route(Http1Connection.java:414)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http1.Http1Connection.handle(Http1Connection.java:187)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.ConnectionHandler.run(ConnectionHandler.java:165)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.common.task.InterruptableTask.call(InterruptableTask.java:47)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.http.RequestException$Builder.build(RequestException.java:139)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.ThreadPerTaskExecutor$ThreadBoundFuture.run(ThreadPerTaskExecutor.java:239)
Jan 08 11:19:39 services02 podman[1710254]:         at java.base/java.lang.VirtualThread.run(Unknown Source)
Jan 08 11:19:39 services02 podman[1710254]: Caused by: java.lang.IllegalStateException: No user ID has been set.
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADatabaseTransaction.userId(CADatabaseTransaction.java:230)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADBQItemTypesAssign.onExecute(CADBQItemTypesAssign.java:101)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADBQItemTypesAssign.onExecute(CADBQItemTypesAssign.java:41)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADBQAbstract.execute(CADBQAbstract.java:95)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICmdItemTypesAssign.executeActual(CAICmdItemTypesAssign.java:69)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICmdItemTypesAssign.executeActual(CAICmdItemTypesAssign.java:38)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICmdAbstract.execute(CAICmdAbstract.java:56)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICommandExecutor.executeCommand(CAICommandExecutor.java:224)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICommandExecutor.execute(CAICommandExecutor.java:109)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.executeCommand(CA1HandlerCommand.java:240)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.execute(CA1HandlerCommand.java:127)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.lambda$createCore$0(CA1HandlerCommand.java:94)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.unhandledError(ErrorHandlers.java:202)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCoreTransactional.execute(CA1HandlerCoreTransactional.java:82)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.lambda$createCore$1(CA1HandlerCommand.java:105)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCoreAuthenticated.execute(CA1HandlerCoreAuthenticated.java:147)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.http.CAHTTPHandlerCoreInstrumented.execute(CAHTTPHandlerCoreInstrumented.java:109)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/com.io7m.cardant.server.http.CAHTTPHandlerFunctional.handle(CAHTTPHandlerFunctional.java:76)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.HttpRouting$RoutingExecutor.doRoute(HttpRouting.java:668)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.HttpRouting$RoutingExecutor.call(HttpRouting.java:627)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.HttpRouting$RoutingExecutor.call(HttpRouting.java:605)
Jan 08 11:19:39 services02 podman[1710254]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
Jan 08 11:19:39 services02 podman[1710254]:         ... 14 common frames omitted
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.lambda$handleError$1(ErrorHandlers.java:182)
Jan 08 11:19:39 services02 cardant01[1710329]:         at java.base/java.util.Optional.ifPresentOrElse(Unknown Source)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.handleError(ErrorHandlers.java:181)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:118)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:121)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.http.CAHTTPRequestTimeFilter.filter(CAHTTPRequestTimeFilter.java:69)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.Filters.executeFilters(Filters.java:87)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.Filters.lambda$filter$0(Filters.java:83)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.Filters.filter(Filters.java:83)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.HttpRouting.route(HttpRouting.java:109)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http1.Http1Connection.route(Http1Connection.java:414)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http1.Http1Connection.handle(Http1Connection.java:187)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.ConnectionHandler.run(ConnectionHandler.java:165)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.common.task.InterruptableTask.call(InterruptableTask.java:47)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.ThreadPerTaskExecutor$ThreadBoundFuture.run(ThreadPerTaskExecutor.java:239)
Jan 08 11:19:39 services02 cardant01[1710329]:         at java.base/java.lang.VirtualThread.run(Unknown Source)
Jan 08 11:19:39 services02 cardant01[1710329]: Caused by: java.lang.IllegalStateException: No user ID has been set.
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADatabaseTransaction.userId(CADatabaseTransaction.java:230)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADBQItemTypesAssign.onExecute(CADBQItemTypesAssign.java:101)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADBQItemTypesAssign.onExecute(CADBQItemTypesAssign.java:41)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.database.postgres.internal.CADBQAbstract.execute(CADBQAbstract.java:95)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICmdItemTypesAssign.executeActual(CAICmdItemTypesAssign.java:69)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICmdItemTypesAssign.executeActual(CAICmdItemTypesAssign.java:38)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICmdAbstract.execute(CAICmdAbstract.java:56)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICommandExecutor.executeCommand(CAICommandExecutor.java:224)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.controller.inventory.CAICommandExecutor.execute(CAICommandExecutor.java:109)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.executeCommand(CA1HandlerCommand.java:240)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.execute(CA1HandlerCommand.java:127)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.lambda$createCore$0(CA1HandlerCommand.java:94)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCoreTransactional.execute(CA1HandlerCoreTransactional.java:82)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCommand.lambda$createCore$1(CA1HandlerCommand.java:105)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.inventory.v1.CA1HandlerCoreAuthenticated.execute(CA1HandlerCoreAuthenticated.java:147)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.http.CAHTTPHandlerCoreInstrumented.execute(CAHTTPHandlerCoreInstrumented.java:109)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/com.io7m.cardant.server.http.CAHTTPHandlerFunctional.handle(CAHTTPHandlerFunctional.java:76)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.HttpRouting$RoutingExecutor.doRoute(HttpRouting.java:668)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.HttpRouting$RoutingExecutor.call(HttpRouting.java:627)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.HttpRouting$RoutingExecutor.call(HttpRouting.java:605)
Jan 08 11:19:39 services02 cardant01[1710329]:         at [email protected]/io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
Jan 08 11:19:39 services02 cardant01[1710329]:         ... 14 common frames omitted

Audit logging

Add a table to the database that stores a log of inventory operations.

Stock API

The Item structure contains count values, one of which is unused.

Provide better APIs to ask questions about which items are in a location. We already have all the database functionality, and many existing types that can answer these questions, but the API isn't really there.

Stock queries:

  • How many of a particular item do I have over all locations?
    Answer: stockInLocationsCount LocationsAny (ItemExact item) anyOccurrence
  • Assuming I have one or more instances of an item, where are they?
    Answer: stockInLocations LocationsAny (ItemExact item) anyOccurrence
  • What items are in a given location (including/not including descendants)?
    Answer: stockInLocations (LocationExact location) ItemAny anyOccurrence
  • What serial numbers exist for an item? (#93)
    Answer: stockInLocations LocationsAny (ItemExact item) (Set SERIAL)
sealed interface LocationMatch
record LocationExact(Location location)
record LocationAndDescendants(Location location)
record LocationAny()

sealed interface StockOccurrence
record StockOccurrenceSet(Location location, ItemSummary item, long count)
record StockOccurrenceSerial(Location location, ItemSummary item, String serial)

enum StockOccurrenceKind { SET, SERIAL }
anyOccurrence :: Set<StockOccurrenceKind>
anyOccurrence = Set(SET, SERIAL)
stockInLocationsCount : LocationMatch -> ItemMatch -> Set<StockOccurrenceKind> -> Long
stockInLocations      : LocationMatch -> ItemMatch -> Set<StockOccurrenceKind> -> List<Page<StockOccurrence>>

Item repositing would be moved to stock repositing.

No commands to delete locations

This is aggravated by the fact that location-put with no arguments will generate an ID and create a location. You can create a location with a random ID that you then can't remove, just by typing the name of the command.

Consider dropping all type structure from the database

Record types, scalar types, etc, are all unpacked from type packages into tables in the database. This happened because the type system was designed prior to type packages existing.

The code has to do all kinds of contortions during upgrades to keep this structure up-to-date. It seems like it would be better to reformulate metadata and types somehow. Keep type packages in the database as serialized XML as they are now. Unpack all type packages on server startup and implement a type checking service.

Metadata names should also contain packages to avoid ambiguity.

com.io7m.example.t.x

This refers to field x of type t in package com.io7m.example. Let's make this explicit:

com.io7m.example:t.x

Type packages

Versioned, installable packages of predefined types.

Would require defining a text format for types, and an API for atomically uploading and installing a type package.

  • Format for packages
  • Install packages
  • Uninstall packages
  • Upgrade packages
  • List/search packages
  • Retrieve package text

Problems:

  • Uninstalling a package while an item still has a type assigned to it that was declared in the package.
    • Require the user to specify whether they want types to be deleted anyway √
  • Upgrading to a version of a package that removes a type, whilst items still have the types assigned.

In order to guarantee consistency and safe upgrades, the ability to add types outside of a package will be removed.

Malformed metadata match syntax rules in shell

[cardant]$ syntax-show --rule metadata-match
metadata-match := 
  anything
  
  | metadata-match-and
  | metadata-match-match
  | metadata-match-or
  | metadata-value-match-within-range-integral
  | metadata-value-match-with-currency
  | metadata-value-match-within-range-money
  | metadata-value-match-within-range-real
  | metadata-value-match-with-text-exact
  | metadata-value-match-with-text-search
  | metadata-value-match-within-range-time
java.lang.NullPointerException: rule
	at java.base/java.util.Objects.requireNonNull(Objects.java:259)
	at [email protected]/com.io7m.cardant.shell.internal.CAShellCmdSyntaxShow.formatRule(CAShellCmdSyntaxShow.java:146)
	at [email protected]/com.io7m.cardant.shell.internal.CAShellCmdSyntaxShow.formatRule(CAShellCmdSyntaxShow.java:155)
	at [email protected]/com.io7m.cardant.shell.internal.CAShellCmdSyntaxShow.onExecute(CAShellCmdSyntaxShow.java:135)
	at [email protected]/com.io7m.cardant.shell.internal.CAShell.runForOneLine(CAShell.java:250)
	at [email protected]/com.io7m.cardant.shell.internal.CAShell.run(CAShell.java:146)
	at [email protected]/com.io7m.cardant.main.internal.CMCmdShell.onExecute(CMCmdShell.java:120)
	at [email protected]/com.io7m.quarrel.core.internal.QCommandContext.execute(QCommandContext.java:207)
	at [email protected]/com.io7m.quarrel.core.QApplicationType.run(QApplicationType.java:94)
	at [email protected]/com.io7m.cardant.main.CAMain.run(CAMain.java:153)
	at [email protected]/com.io7m.cardant.main.CAMain.mainExitless(CAMain.java:128)
	at [email protected]/com.io7m.cardant.main.CAMain.main(CAMain.java:113)

Error reporting for match expressions could be a lot better

[cardant]$ item-search-begin --metadata-match '[match [with-name-exact manufacturer] any-value]'
Error: The value supplied for a parameter is unparseable.
  Command          : item-search-begin
  Error Code       : parameter-unparseable-value
  Parameter        : --metadata-match
  Provided         : [match [with-name-exact manufacturer] any-value]
  Suggested Action : Provide a parseable value on the command-line.
  Syntax           : <metadata-match>
  Type             : com.io7m.cardant.model.CAMetadataElementMatchType

Support item instances with identity

Currently, the system manages items by class. Sets of identityless items exist in storage locations.

Some items have a meaningful identity, like a serial number. The system currently has no way to state something along the lines of "an item with serial number X exists in location Y".

`type-record-get` output is less than useful

[cardant]$ type-record-get --name cardant.computer.dram
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────┐
│ Type                                                                                                                                                        │ Description    │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────┤
│ cardant.computer.dram                                                                                                                                       │ A DRAM module. │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────┘

The fields should be listed.

Typed metadata

Item metadata is currently a Map<String, String>, effectively. This isn't good enough for long term data consistency.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.