This repository was archived by the owner on Jan 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,7 +226,11 @@ ECLib.prototype = {
226226 hd : 0 ,
227227 ct : 0
228228 } ;
229- }
229+ } ,
230+
231+ getAlignedDataSize : function ( objSize ) {
232+ return addon . EclGetAlignedDataSize ( this . ins_id , objSize ) ;
233+ } ,
230234}
231235
232236module . exports = ECLib ;
Original file line number Diff line number Diff line change @@ -103,8 +103,23 @@ NAN_METHOD(EclVerifyStripeMetadata) {
103103
104104NAN_METHOD (EclGetAlignedDataSize) {
105105 Nan::HandleScope scope;
106- info.GetReturnValue ()
107- .Set (Nan::New (" C++ GetAlignedDataSize " ).ToLocalChecked ());
106+
107+ if (info.Length () != 2 ) {
108+ Nan::ThrowTypeError (" Wrong number of arguments EclGetAlignedDataSize" );
109+ return ;
110+ }
111+
112+ ec_backend_t instance;
113+ uint32_t aligned_size;
114+
115+ int desc = Nan::To<int >(info[0 ]).FromJust ();
116+ int64_t obj_size = Nan::To<int64_t >(info[1 ]).FromJust ();
117+
118+ instance = liberasurecode_backend_instance_get_by_desc (desc);
119+
120+ aligned_size = get_aligned_data_size (instance, obj_size);
121+
122+ info.GetReturnValue ().Set (aligned_size);
108123}
109124
110125NAN_METHOD (EclGetMinimumEncodeSize) {
Original file line number Diff line number Diff line change 2828#include <nan.h>
2929#include <liberasurecode/erasurecode.h>
3030#include <liberasurecode/erasurecode_helpers.h>
31+ extern "C" {
32+ #include <liberasurecode/erasurecode_helpers_ext.h>
33+ #include <liberasurecode/erasurecode_postprocessing.h>
34+ }
3135
3236NAN_METHOD (EclCreate );
3337NAN_METHOD (EclDestroy );
You can’t perform that action at this time.
0 commit comments