-
Notifications
You must be signed in to change notification settings - Fork 7
Usage license #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage license #205
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -27,8 +27,149 @@ Returns the registration data of the Harper instance. | |||||||||||||
|
||||||||||||||
--- | ||||||||||||||
|
||||||||||||||
## Install Usage License | ||||||||||||||
|
||||||||||||||
Install a Harper license for a block of usage. Multiple usage blocks may be installed, and they will be used up sequentially, with the earliest installed blocks used first. A license is installed | ||||||||||||||
by creating a string that consists of three base64 encoded blocks, separated by dots. The three blocks consist of: | ||||||||||||||
* header: This is a JSON object with two properties: | ||||||||||||||
* typ: should be "Harper-License" | ||||||||||||||
* alg: should be "EdDSA" | ||||||||||||||
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how this will eventually be rendered, but maybe the properties should be
Suggested change
|
||||||||||||||
|
||||||||||||||
This JSON object should be converted to base64 (conversion from utf-8 to base64) and is the first base64 block. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used base64url encoding originally (mostly just because it's what JWTs use and it seemed the safer choice overall). So unless you changed that, we should specify that here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not change the code, so yes, make it |
||||||||||||||
|
||||||||||||||
* license payload: This is a JSON object with properties: | ||||||||||||||
* id _(required)_ - A unique id for the license | ||||||||||||||
* level _(required)_ - Usage level number | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was no description of this attribute in the original ticket, so the code currently expects it to be a string. I can adjust it to expect a number, but is there any more context about what this value is and any other constraints that should be placed on it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This corresponds to the different levels from https://harperdb.atlassian.net/wiki/spaces/SD/pages/34209804/HarperDB+Usage+Pricing+and+Tracking. I don't think we have any functional behavior that depends on this (right now), so it is just informational. We could make this optional (and |
||||||||||||||
* regiondId _(required)_ - The region id where this license can be used | ||||||||||||||
* reads _(required)_ - The number of allowed reads | ||||||||||||||
* readBytes _(required)_ - The number of allowed read bytes | ||||||||||||||
* writes _(required)_ - The number of allowed writes | ||||||||||||||
* writeBytes _(required)_ - The number of allowed write bytes | ||||||||||||||
* realTimeMessages _(required)_ - The number of allowed real-time messages | ||||||||||||||
* realTimeBytes _(required)_ - The number of allowed real-time message bytes | ||||||||||||||
* cpuTime _(optional)_ - The allowed amount of CPU time consumed by application code | ||||||||||||||
* storage _(optional)_ - Maximum of storage that may be used | ||||||||||||||
* expiration _(required_) - The date when this block expires, as an ISO date | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/required_)/required)_/ |
||||||||||||||
|
||||||||||||||
This JSON object should be converted to base64 (conversion from utf-8 to base64) and is the second base64 block. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes me wonder if we need any JSON normalization in here... Otherwise differences that a JSON parser would ignore might result in different base64 encodings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't the signing of the JSON based on the generated licenses stringification? It seems like the signer can dictate all of that itself without coordination? But if coordination is needed, maybe we can just say without any extra/unnecessary spacing? (the default for JSON.stringify). |
||||||||||||||
|
||||||||||||||
For example: | ||||||||||||||
```json | ||||||||||||||
{ | ||||||||||||||
"id": "license-717b-4c6c-b69d-b29014054ab7", | ||||||||||||||
"level": 2, | ||||||||||||||
"regionId": "us-nw-2", | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This attribute is just called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Region makes sense to me because of the way we have region + latency sort of grouped together in the block pricing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, |
||||||||||||||
"reads": 2000000000, | ||||||||||||||
"readBytes": 8000000000000, | ||||||||||||||
"writes": 500000000, | ||||||||||||||
"writeBytes": 1000000000000, | ||||||||||||||
"realTimeMessages": 10000000000, | ||||||||||||||
"realTimeBytes": 40000000000000, | ||||||||||||||
"cpuTime": 108000, | ||||||||||||||
"storage": 400000000000000, | ||||||||||||||
"expiration":"2025-07-25T21:17:21.248Z" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
} | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
* signature: This is the cryptographic signature, signed by Harper, of the first two blocks, separated by a dot, `header.payload`. This is also converted to base64. | ||||||||||||||
|
||||||||||||||
The three base64 blocks are combined to form the `license` property value in the operation. | ||||||||||||||
|
||||||||||||||
- operation _(required)_ - must always be `install_usage_license` | ||||||||||||||
- license _(required)_ - This is the combination of the three blocks in the form header.payload.signature | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Elsewhere the value is rendered as inline code.
Suggested change
|
||||||||||||||
### Body | ||||||||||||||
|
||||||||||||||
```json | ||||||||||||||
{ | ||||||||||||||
"operation": "install_usage_license", | ||||||||||||||
"license": "abc...0123.abc...0123.abc...0123", | ||||||||||||||
} | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
### Response: 200 | ||||||||||||||
|
||||||||||||||
```json | ||||||||||||||
{ | ||||||||||||||
"message": "Successfully installed usage license" | ||||||||||||||
} | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
--- | ||||||||||||||
|
||||||||||||||
## Get Usage Licenses | ||||||||||||||
|
||||||||||||||
This will retrieve and return all active usage licenses, with counts of how much of the limits have been consumed. | ||||||||||||||
|
||||||||||||||
- operation _(required)_ - must always be `install_usage_license` | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be |
||||||||||||||
|
||||||||||||||
### Body | ||||||||||||||
|
||||||||||||||
```json | ||||||||||||||
{ | ||||||||||||||
"operation": "get_usage_licenses" | ||||||||||||||
} | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
### Response: 200 | ||||||||||||||
|
||||||||||||||
```json | ||||||||||||||
[ | ||||||||||||||
{ | ||||||||||||||
"id": "license-717b-4c6c-b69d-b29014054ab7", | ||||||||||||||
"level": 2, | ||||||||||||||
"regionId": "us-nw-2", | ||||||||||||||
"reads": 2000000000, | ||||||||||||||
"usedReads": 1100000000, | ||||||||||||||
"readBytes": 8000000000000, | ||||||||||||||
"usedReadBytes": 3000000000000, | ||||||||||||||
"writes": 500000000, | ||||||||||||||
"usedWrites": 300000000, | ||||||||||||||
"writeBytes": 1000000000000, | ||||||||||||||
"usedWriteBytes": 4300000000000, | ||||||||||||||
"realTimeMessages": 10000000000, | ||||||||||||||
"usedRealTimeMessages": 2000000000, | ||||||||||||||
"realTimeBytes": 40000000000000, | ||||||||||||||
"usedRealTimeBytes": 13000000000000, | ||||||||||||||
"cpuTime": 108000, | ||||||||||||||
"usedCpuTime": 41000, | ||||||||||||||
"storage": 400000000000000, | ||||||||||||||
"expiration":"2025-07-25T21:17:21.248Z" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
}, | ||||||||||||||
{ | ||||||||||||||
"id": "license-4c6c-b69d-b29014054ab7-717b", | ||||||||||||||
"level": 2, | ||||||||||||||
"regionId": "us-nw-2", | ||||||||||||||
"reads": 2000000000, | ||||||||||||||
"usedReads": 0, | ||||||||||||||
"readBytes": 8000000000000, | ||||||||||||||
"usedReadBytes": 0, | ||||||||||||||
"writes": 500000000, | ||||||||||||||
"usedWrites": 0, | ||||||||||||||
"writeBytes": 1000000000000, | ||||||||||||||
"usedWriteBytes": 0, | ||||||||||||||
"realTimeMessages": 10000000000, | ||||||||||||||
"usedRealTimeMessages": 0, | ||||||||||||||
"realTimeBytes": 40000000000000, | ||||||||||||||
"usedRealTimeBytes": 0, | ||||||||||||||
"cpuTime": 108000, | ||||||||||||||
"usedCpuTime": 0, | ||||||||||||||
"storage": 400000000000000, | ||||||||||||||
"expiration":"2025-09-25T21:17:21.248Z" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
}, | ||||||||||||||
{ | ||||||||||||||
"id": "license-4c6c-b69d-b29014054ab7-717b", | ||||||||||||||
"level": 2, | ||||||||||||||
"regionId": "us-se-2", | ||||||||||||||
... usage licenses for other regions may be in here as well | ||||||||||||||
] | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
--- | ||||||||||||||
Comment on lines
+164
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what's going on here. Past merge conflict? |
||||||||||||||
|
||||||||||||||
|
||||||||||||||
## Get Fingerprint | ||||||||||||||
|
||||||||||||||
(Deprecated) | ||||||||||||||
Returns the Harper fingerprint, uniquely generated based on the machine, for licensing purposes. | ||||||||||||||
|
||||||||||||||
_Operation is restricted to super_user roles only_ | ||||||||||||||
|
@@ -47,6 +188,7 @@ _Operation is restricted to super_user roles only_ | |||||||||||||
|
||||||||||||||
## Set License | ||||||||||||||
|
||||||||||||||
(Deprecated) | ||||||||||||||
Sets the Harper license as generated by Harper License Management software. | ||||||||||||||
|
||||||||||||||
_Operation is restricted to super_user roles only_ | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### HarperDB 4.5.13 | ||
7/12/2025 | ||
|
||
- Fix cleaning out audit entries when a blob has been removed |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### HarperDB 4.5.14 | ||
7/15/2025 | ||
|
||
- Use proper back-pressure when copying a table for initial database sync |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 4.6.2 | ||
7/15/2025 | ||
|
||
- Use proper back-pressure when copying a table for initial database sync | ||
- Fix cleaning out audit entries when a blob has been removed | ||
- Fix for running CLI operations when a Harper DB is not installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems else where in this page and on other page we are using
-
for lists, not*
. We should be consistent.