-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into jg/staticinit
- Loading branch information
Showing
169 changed files
with
3,648 additions
and
2,019 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# How to migrate ArmoniK.Core dependencies during upgrade ? | ||
|
||
## 0.28.x -> 0.29.x | ||
|
||
### Database | ||
|
||
This version changes the structure of a Result in the database. It introduces a new field called `OpaqueId` which holds the identifier of its associated value in the Object Storage. Previously, the ResultId was used. The following MongoDB request converts the ResultId into the OpaqueId to support the new implementation. | ||
|
||
```js | ||
db.Result.updateMany({}, | ||
[{ | ||
$addFields: { | ||
OpaqueId: { | ||
$function: { | ||
body: function(data) { | ||
const base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | ||
const bytes = []; | ||
for (let i = 0; i < data.length; i++) { | ||
bytes.push(data.charCodeAt(i)); | ||
} | ||
|
||
let base64 = ''; | ||
let i = 0; | ||
while (i < bytes.length) { | ||
let byte1 = bytes[i++] || 0; | ||
let byte2 = bytes[i++] || 0; | ||
let byte3 = bytes[i++] || 0; | ||
|
||
let enc1 = byte1 >> 2; | ||
let enc2 = ((byte1 & 3) << 4) | (byte2 >> 4); | ||
let enc3 = ((byte2 & 15) << 2) | (byte3 >> 6); | ||
let enc4 = byte3 & 63; | ||
|
||
if (isNaN(byte2)) { | ||
enc3 = enc4 = 64; | ||
} else if (isNaN(byte3)) { | ||
enc4 = 64; | ||
} | ||
|
||
base64 += base64Chars[enc1] + base64Chars[enc2] + base64Chars[enc3] + base64Chars[enc4]; | ||
} | ||
|
||
return BinData(0, base64); | ||
}, | ||
args: ["$_id"], | ||
lang: "js" | ||
} | ||
} | ||
} | ||
}]) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.