@@ -478,6 +478,56 @@ public void ping() throws OrisunException {
478478 }
479479 }
480480
481+ /**
482+ * Create a new index on a boundary.
483+ */
484+ public void createIndex (Eventstore .CreateIndexRequest request ) throws OrisunException {
485+ RequestValidator .validateCreateIndexRequest (request );
486+
487+ logger .debug ("Creating index '{}' on boundary '{}'" , request .getName (), request .getBoundary ());
488+
489+ try {
490+ blockingStub
491+ .withDeadlineAfter (defaultTimeoutSeconds , TimeUnit .SECONDS )
492+ .createIndex (request );
493+
494+ logger .info ("Successfully created index '{}' on boundary '{}'" , request .getName (), request .getBoundary ());
495+ } catch (StatusRuntimeException e ) {
496+ Map <String , Object > context = new HashMap <>();
497+ context .put ("operation" , "createIndex" );
498+ context .put ("boundary" , request .getBoundary ());
499+ context .put ("indexName" , request .getName ());
500+ context .put ("statusCode" , e .getStatus ().getCode ().name ());
501+
502+ throw new OrisunException ("Failed to create index" , e , context );
503+ }
504+ }
505+
506+ /**
507+ * Drop an index from a boundary.
508+ */
509+ public void dropIndex (Eventstore .DropIndexRequest request ) throws OrisunException {
510+ RequestValidator .validateDropIndexRequest (request );
511+
512+ logger .debug ("Dropping index '{}' from boundary '{}'" , request .getName (), request .getBoundary ());
513+
514+ try {
515+ blockingStub
516+ .withDeadlineAfter (defaultTimeoutSeconds , TimeUnit .SECONDS )
517+ .dropIndex (request );
518+
519+ logger .info ("Successfully dropped index '{}' from boundary '{}'" , request .getName (), request .getBoundary ());
520+ } catch (StatusRuntimeException e ) {
521+ Map <String , Object > context = new HashMap <>();
522+ context .put ("operation" , "dropIndex" );
523+ context .put ("boundary" , request .getBoundary ());
524+ context .put ("indexName" , request .getName ());
525+ context .put ("statusCode" , e .getStatus ().getCode ().name ());
526+
527+ throw new OrisunException ("Failed to drop index" , e , context );
528+ }
529+ }
530+
481531 /**
482532 * Check if the client is connected to the server
483533 *
@@ -518,4 +568,4 @@ public void close() {
518568 }
519569 }
520570 }
521- }
571+ }
0 commit comments