Skip to content

Commit be75c3c

Browse files
committed
Added method to count URLs in a frontier
Signed-off-by: Laurent Klock <[email protected]>
1 parent 44b80b7 commit be75c3c

File tree

9 files changed

+1293
-32
lines changed

9 files changed

+1293
-32
lines changed

API/src/main/java/crawlercommons/urlfrontier/URLFrontierGrpc.java

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,57 @@ private URLFrontierGrpc() {}
844844
return getListURLsMethod;
845845
}
846846

847+
private static volatile io.grpc.MethodDescriptor<
848+
crawlercommons.urlfrontier.Urlfrontier.CountUrlParams,
849+
crawlercommons.urlfrontier.Urlfrontier.Long>
850+
getCountURLsMethod;
851+
852+
@io.grpc.stub.annotations.RpcMethod(
853+
fullMethodName = SERVICE_NAME + '/' + "CountURLs",
854+
requestType = crawlercommons.urlfrontier.Urlfrontier.CountUrlParams.class,
855+
responseType = crawlercommons.urlfrontier.Urlfrontier.Long.class,
856+
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
857+
public static io.grpc.MethodDescriptor<
858+
crawlercommons.urlfrontier.Urlfrontier.CountUrlParams,
859+
crawlercommons.urlfrontier.Urlfrontier.Long>
860+
getCountURLsMethod() {
861+
io.grpc.MethodDescriptor<
862+
crawlercommons.urlfrontier.Urlfrontier.CountUrlParams,
863+
crawlercommons.urlfrontier.Urlfrontier.Long>
864+
getCountURLsMethod;
865+
if ((getCountURLsMethod = URLFrontierGrpc.getCountURLsMethod) == null) {
866+
synchronized (URLFrontierGrpc.class) {
867+
if ((getCountURLsMethod = URLFrontierGrpc.getCountURLsMethod) == null) {
868+
URLFrontierGrpc.getCountURLsMethod =
869+
getCountURLsMethod =
870+
io.grpc.MethodDescriptor
871+
.<crawlercommons.urlfrontier.Urlfrontier.CountUrlParams,
872+
crawlercommons.urlfrontier.Urlfrontier.Long>
873+
newBuilder()
874+
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
875+
.setFullMethodName(
876+
generateFullMethodName(
877+
SERVICE_NAME, "CountURLs"))
878+
.setSampledToLocalTracing(true)
879+
.setRequestMarshaller(
880+
io.grpc.protobuf.ProtoUtils.marshaller(
881+
crawlercommons.urlfrontier.Urlfrontier
882+
.CountUrlParams
883+
.getDefaultInstance()))
884+
.setResponseMarshaller(
885+
io.grpc.protobuf.ProtoUtils.marshaller(
886+
crawlercommons.urlfrontier.Urlfrontier
887+
.Long.getDefaultInstance()))
888+
.setSchemaDescriptor(
889+
new URLFrontierMethodDescriptorSupplier(
890+
"CountURLs"))
891+
.build();
892+
}
893+
}
894+
}
895+
return getCountURLsMethod;
896+
}
897+
847898
/** Creates a new async stub that supports all call types for the service */
848899
public static URLFrontierStub newStub(io.grpc.Channel channel) {
849900
io.grpc.stub.AbstractStub.StubFactory<URLFrontierStub> factory =
@@ -1137,6 +1188,15 @@ default void listURLs(
11371188
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
11381189
getListURLsMethod(), responseObserver);
11391190
}
1191+
1192+
/** */
1193+
default void countURLs(
1194+
crawlercommons.urlfrontier.Urlfrontier.CountUrlParams request,
1195+
io.grpc.stub.StreamObserver<crawlercommons.urlfrontier.Urlfrontier.Long>
1196+
responseObserver) {
1197+
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
1198+
getCountURLsMethod(), responseObserver);
1199+
}
11401200
}
11411201

11421202
/** Base class for the server implementation of the service URLFrontier. */
@@ -1439,6 +1499,17 @@ public void listURLs(
14391499
request,
14401500
responseObserver);
14411501
}
1502+
1503+
/** */
1504+
public void countURLs(
1505+
crawlercommons.urlfrontier.Urlfrontier.CountUrlParams request,
1506+
io.grpc.stub.StreamObserver<crawlercommons.urlfrontier.Urlfrontier.Long>
1507+
responseObserver) {
1508+
io.grpc.stub.ClientCalls.asyncUnaryCall(
1509+
getChannel().newCall(getCountURLsMethod(), getCallOptions()),
1510+
request,
1511+
responseObserver);
1512+
}
14421513
}
14431514

14441515
/** A stub to allow clients to do synchronous rpc calls to service URLFrontier. */
@@ -1658,6 +1729,13 @@ public java.util.Iterator<crawlercommons.urlfrontier.Urlfrontier.URLItem> listUR
16581729
return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
16591730
getChannel(), getListURLsMethod(), getCallOptions(), request);
16601731
}
1732+
1733+
/** */
1734+
public crawlercommons.urlfrontier.Urlfrontier.Long countURLs(
1735+
crawlercommons.urlfrontier.Urlfrontier.CountUrlParams request) {
1736+
return io.grpc.stub.ClientCalls.blockingUnaryCall(
1737+
getChannel(), getCountURLsMethod(), getCallOptions(), request);
1738+
}
16611739
}
16621740

16631741
/** A stub to allow clients to do ListenableFuture-style rpc calls to service URLFrontier. */
@@ -1862,6 +1940,14 @@ protected URLFrontierFutureStub build(
18621940
return io.grpc.stub.ClientCalls.futureUnaryCall(
18631941
getChannel().newCall(getGetURLStatusMethod(), getCallOptions()), request);
18641942
}
1943+
1944+
/** */
1945+
public com.google.common.util.concurrent.ListenableFuture<
1946+
crawlercommons.urlfrontier.Urlfrontier.Long>
1947+
countURLs(crawlercommons.urlfrontier.Urlfrontier.CountUrlParams request) {
1948+
return io.grpc.stub.ClientCalls.futureUnaryCall(
1949+
getChannel().newCall(getCountURLsMethod(), getCallOptions()), request);
1950+
}
18651951
}
18661952

18671953
private static final int METHODID_LIST_NODES = 0;
@@ -1879,7 +1965,8 @@ protected URLFrontierFutureStub build(
18791965
private static final int METHODID_SET_CRAWL_LIMIT = 12;
18801966
private static final int METHODID_GET_URLSTATUS = 13;
18811967
private static final int METHODID_LIST_URLS = 14;
1882-
private static final int METHODID_PUT_URLS = 15;
1968+
private static final int METHODID_COUNT_URLS = 15;
1969+
private static final int METHODID_PUT_URLS = 16;
18831970

18841971
private static final class MethodHandlers<Req, Resp>
18851972
implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
@@ -2003,6 +2090,13 @@ public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserv
20032090
crawlercommons.urlfrontier.Urlfrontier.URLItem>)
20042091
responseObserver);
20052092
break;
2093+
case METHODID_COUNT_URLS:
2094+
serviceImpl.countURLs(
2095+
(crawlercommons.urlfrontier.Urlfrontier.CountUrlParams) request,
2096+
(io.grpc.stub.StreamObserver<
2097+
crawlercommons.urlfrontier.Urlfrontier.Long>)
2098+
responseObserver);
2099+
break;
20062100
default:
20072101
throw new AssertionError();
20082102
}
@@ -2142,6 +2236,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser
21422236
crawlercommons.urlfrontier.Urlfrontier.ListUrlParams,
21432237
crawlercommons.urlfrontier.Urlfrontier.URLItem>(
21442238
service, METHODID_LIST_URLS)))
2239+
.addMethod(
2240+
getCountURLsMethod(),
2241+
io.grpc.stub.ServerCalls.asyncUnaryCall(
2242+
new MethodHandlers<
2243+
crawlercommons.urlfrontier.Urlfrontier.CountUrlParams,
2244+
crawlercommons.urlfrontier.Urlfrontier.Long>(
2245+
service, METHODID_COUNT_URLS)))
21452246
.build();
21462247
}
21472248

@@ -2210,6 +2311,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
22102311
.addMethod(getSetCrawlLimitMethod())
22112312
.addMethod(getGetURLStatusMethod())
22122313
.addMethod(getListURLsMethod())
2314+
.addMethod(getCountURLsMethod())
22132315
.build();
22142316
}
22152317
}

0 commit comments

Comments
 (0)