Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apiServer/src/main/protobuf/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ message SendResultRequest {
repeated Coordinate ghostRecord = 3;
}

message GetPublicRoomResponse {
int32 vagrantRoom = 1;
}

message Empty {}

service RoomService {
Expand All @@ -94,6 +98,9 @@ service RoomService {
rpc ParentOperation(ParentOperationRequest) returns (stream Operation) {};

rpc SendResult(SendResultRequest) returns (Empty) {};

// まだ埋まっていない公開部屋数
rpc GetPublicRoom(Empty) returns (GetPublicRoomResponse) {};
}


Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,12 @@ class RoomAggregates[T, Coordinate, Operation](implicit materializer: Materializ
source
}

def getPublicRoom: Int = {
this.rooms.count { room =>
// 埋まっていない && パブリック
!room._2.isFull && room._2.roomKey.isEmpty
}
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ class RoomServicePowerApiImpl(implicit materializer: Materializer) extends RoomS
}
.fold(Future.failed[Empty](new Exception("Internal Error!!!")))(_ => Future.successful(Empty()))
}

// まだ埋まっていない公開部屋数
override def getPublicRoom(in: Empty, metadata: Metadata): Future[GetPublicRoomResponse] = {
Future.successful(GetPublicRoomResponse(roomAggregates.getPublicRoom))
}

}