Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9b49712

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
feat: omit release details to speed up lib search
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 0ab2826 commit 9b49712

File tree

4 files changed

+102
-8
lines changed

4 files changed

+102
-8
lines changed

‎arduino-ide-extension/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"version": {
167167
"owner": "arduino",
168168
"repo": "arduino-cli",
169-
"commitish": "6992de7"
169+
"commitish": "71a8576"
170170
}
171171
},
172172
"fwuploader": {

‎arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/lib_pb.d.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ export class LibrarySearchRequest extends jspb.Message {
406406
getQuery(): string;
407407
setQuery(value: string): LibrarySearchRequest;
408408

409+
getOmitReleasesDetails(): boolean;
410+
setOmitReleasesDetails(value: boolean): LibrarySearchRequest;
411+
409412

410413
serializeBinary(): Uint8Array;
411414
toObject(includeInstance?: boolean): LibrarySearchRequest.AsObject;
@@ -421,6 +424,7 @@ export namespace LibrarySearchRequest {
421424
export type AsObject = {
422425
instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject,
423426
query: string,
427+
omitReleasesDetails: boolean,
424428
}
425429
}
426430

@@ -465,6 +469,11 @@ export class SearchedLibrary extends jspb.Message {
465469
getLatest(): LibraryRelease | undefined;
466470
setLatest(value?: LibraryRelease): SearchedLibrary;
467471

472+
clearAvailableVersionsList(): void;
473+
getAvailableVersionsList(): Array<string>;
474+
setAvailableVersionsList(value: Array<string>): SearchedLibrary;
475+
addAvailableVersions(value: string, index?: number): string;
476+
468477

469478
serializeBinary(): Uint8Array;
470479
toObject(includeInstance?: boolean): SearchedLibrary.AsObject;
@@ -482,6 +491,7 @@ export namespace SearchedLibrary {
482491

483492
releasesMap: Array<[string, LibraryRelease.AsObject]>,
484493
latest?: LibraryRelease.AsObject,
494+
availableVersionsList: Array<string>,
485495
}
486496
}
487497

‎arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/lib_pb.js‎

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ if (goog.DEBUG && !COMPILED) {
374374
* @constructor
375375
*/
376376
proto.cc.arduino.cli.commands.v1.SearchedLibrary = function(opt_data) {
377-
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
377+
jspb.Message.initialize(this, opt_data, 0, -1, proto.cc.arduino.cli.commands.v1.SearchedLibrary.repeatedFields_, null);
378378
};
379379
goog.inherits(proto.cc.arduino.cli.commands.v1.SearchedLibrary, jspb.Message);
380380
if (goog.DEBUG && !COMPILED) {
@@ -3202,7 +3202,8 @@ proto.cc.arduino.cli.commands.v1.LibrarySearchRequest.prototype.toObject = funct
32023202
proto.cc.arduino.cli.commands.v1.LibrarySearchRequest.toObject = function(includeInstance, msg) {
32033203
var f, obj = {
32043204
instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f),
3205-
query: jspb.Message.getFieldWithDefault(msg, 2, "")
3205+
query: jspb.Message.getFieldWithDefault(msg, 2, ""),
3206+
omitReleasesDetails: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
32063207
};
32073208

32083209
if (includeInstance) {
@@ -3248,6 +3249,10 @@ proto.cc.arduino.cli.commands.v1.LibrarySearchRequest.deserializeBinaryFromReade
32483249
var value = /** @type {string} */ (reader.readString());
32493250
msg.setQuery(value);
32503251
break;
3252+
case 3:
3253+
var value = /** @type {boolean} */ (reader.readBool());
3254+
msg.setOmitReleasesDetails(value);
3255+
break;
32513256
default:
32523257
reader.skipField();
32533258
break;
@@ -3292,6 +3297,13 @@ proto.cc.arduino.cli.commands.v1.LibrarySearchRequest.serializeBinaryToWriter =
32923297
f
32933298
);
32943299
}
3300+
f = message.getOmitReleasesDetails();
3301+
if (f) {
3302+
writer.writeBool(
3303+
3,
3304+
f
3305+
);
3306+
}
32953307
};
32963308

32973309

@@ -3350,6 +3362,24 @@ proto.cc.arduino.cli.commands.v1.LibrarySearchRequest.prototype.setQuery = funct
33503362
};
33513363

33523364

3365+
/**
3366+
* optional bool omit_releases_details = 3;
3367+
* @return {boolean}
3368+
*/
3369+
proto.cc.arduino.cli.commands.v1.LibrarySearchRequest.prototype.getOmitReleasesDetails = function() {
3370+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
3371+
};
3372+
3373+
3374+
/**
3375+
* @param {boolean} value
3376+
* @return {!proto.cc.arduino.cli.commands.v1.LibrarySearchRequest} returns this
3377+
*/
3378+
proto.cc.arduino.cli.commands.v1.LibrarySearchRequest.prototype.setOmitReleasesDetails = function(value) {
3379+
return jspb.Message.setProto3BooleanField(this, 3, value);
3380+
};
3381+
3382+
33533383

33543384
/**
33553385
* List of repeated fields within this message type.
@@ -3541,6 +3571,13 @@ proto.cc.arduino.cli.commands.v1.LibrarySearchResponse.prototype.setStatus = fun
35413571

35423572

35433573

3574+
/**
3575+
* List of repeated fields within this message type.
3576+
* @private {!Array<number>}
3577+
* @const
3578+
*/
3579+
proto.cc.arduino.cli.commands.v1.SearchedLibrary.repeatedFields_ = [4];
3580+
35443581

35453582

35463583
if (jspb.Message.GENERATE_TO_OBJECT) {
@@ -3574,7 +3611,8 @@ proto.cc.arduino.cli.commands.v1.SearchedLibrary.toObject = function(includeInst
35743611
var f, obj = {
35753612
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
35763613
releasesMap: (f = msg.getReleasesMap()) ? f.toObject(includeInstance, proto.cc.arduino.cli.commands.v1.LibraryRelease.toObject) : [],
3577-
latest: (f = msg.getLatest()) && proto.cc.arduino.cli.commands.v1.LibraryRelease.toObject(includeInstance, f)
3614+
latest: (f = msg.getLatest()) && proto.cc.arduino.cli.commands.v1.LibraryRelease.toObject(includeInstance, f),
3615+
availableVersionsList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f
35783616
};
35793617

35803618
if (includeInstance) {
@@ -3626,6 +3664,10 @@ proto.cc.arduino.cli.commands.v1.SearchedLibrary.deserializeBinaryFromReader = f
36263664
reader.readMessage(value,proto.cc.arduino.cli.commands.v1.LibraryRelease.deserializeBinaryFromReader);
36273665
msg.setLatest(value);
36283666
break;
3667+
case 4:
3668+
var value = /** @type {string} */ (reader.readString());
3669+
msg.addAvailableVersions(value);
3670+
break;
36293671
default:
36303672
reader.skipField();
36313673
break;
@@ -3674,6 +3716,13 @@ proto.cc.arduino.cli.commands.v1.SearchedLibrary.serializeBinaryToWriter = funct
36743716
proto.cc.arduino.cli.commands.v1.LibraryRelease.serializeBinaryToWriter
36753717
);
36763718
}
3719+
f = message.getAvailableVersionsList();
3720+
if (f.length > 0) {
3721+
writer.writeRepeatedString(
3722+
4,
3723+
f
3724+
);
3725+
}
36773726
};
36783727

36793728

@@ -3754,6 +3803,43 @@ proto.cc.arduino.cli.commands.v1.SearchedLibrary.prototype.hasLatest = function(
37543803
};
37553804

37563805

3806+
/**
3807+
* repeated string available_versions = 4;
3808+
* @return {!Array<string>}
3809+
*/
3810+
proto.cc.arduino.cli.commands.v1.SearchedLibrary.prototype.getAvailableVersionsList = function() {
3811+
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 4));
3812+
};
3813+
3814+
3815+
/**
3816+
* @param {!Array<string>} value
3817+
* @return {!proto.cc.arduino.cli.commands.v1.SearchedLibrary} returns this
3818+
*/
3819+
proto.cc.arduino.cli.commands.v1.SearchedLibrary.prototype.setAvailableVersionsList = function(value) {
3820+
return jspb.Message.setField(this, 4, value || []);
3821+
};
3822+
3823+
3824+
/**
3825+
* @param {string} value
3826+
* @param {number=} opt_index
3827+
* @return {!proto.cc.arduino.cli.commands.v1.SearchedLibrary} returns this
3828+
*/
3829+
proto.cc.arduino.cli.commands.v1.SearchedLibrary.prototype.addAvailableVersions = function(value, opt_index) {
3830+
return jspb.Message.addToRepeatedField(this, 4, value, opt_index);
3831+
};
3832+
3833+
3834+
/**
3835+
* Clears the list making it empty but non-null.
3836+
* @return {!proto.cc.arduino.cli.commands.v1.SearchedLibrary} returns this
3837+
*/
3838+
proto.cc.arduino.cli.commands.v1.SearchedLibrary.prototype.clearAvailableVersionsList = function() {
3839+
return this.setAvailableVersionsList([]);
3840+
};
3841+
3842+
37573843

37583844
/**
37593845
* List of repeated fields within this message type.

‎arduino-ide-extension/src/node/library-service-impl.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class LibraryServiceImpl
7979
const req = new LibrarySearchRequest();
8080
req.setQuery(options.query || '');
8181
req.setInstance(instance);
82+
req.setOmitReleasesDetails(true);
8283
const resp = await new Promise<LibrarySearchResponse>((resolve, reject) =>
8384
client.librarySearch(req, (err, resp) =>
8485
!!err ? reject(err) : resolve(resp)
@@ -88,11 +89,8 @@ export class LibraryServiceImpl
8889
.getLibrariesList()
8990
.filter((item) => !!item.getLatest())
9091
.map((item) => {
91-
// TODO: This seems to contain only the latest item instead of all of the items.
9292
const availableVersions = item
93-
.getReleasesMap()
94-
.getEntryList()
95-
.map(([key, _]) => key)
93+
.getAvailableVersionsList()
9694
.sort(Installable.Version.COMPARATOR)
9795
.reverse();
9896
let installedVersion: string | undefined;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /