MultiServerMan/README.md

71 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 需求概述
- 项目的主要业务需求:
给定一个服务端模板开启n个服务器并在接口请求时返回可用服务器的地址。
管理在线服务器的数量。
- 项目的非功能需求:
分布式系统(会同时运行在多台机器上)
### 功能需求
- 根据给定的服务端模板,可用端口范围生成多个服务器实例。
- 回收已经标记为结束的服务器。
- 接口请求时返回一个可用的服务器ip。
- 记录对局的id开始时间结束时间参与玩家id到数据库中。
## 非功能需求
- 可以增加机器的数量。例如有AB两台机器A机器资源占满B机器有余量。收到请求时会在B机器开启新的服务器并返回ip
- 保持一定数量的可用服务器,在请求时可以立刻返回。
## 界面设计和交互
无ui需求bat就行。
## 接口需求
### `func getServer()`
- 接口描述获取一个可用的服务器ip并记录该对局的参与玩家。
- 返回值:
- String类型的ip地址带端口
- Int类型的对局id
- 参数列表:
- `ArrayList<Player> players`
### `func informEnd()`
- 接口描述:告知系统某个对局结束了
- 返回值:无
- 参数列表:
- int id
### `func getPlayerServer()`
- 接口描述获取某个玩家还在进行中的对局的服务器的ip地址
- 返回值:
- String 类型的ip地址带端口未在对局中返回null
- Int 类型的对局id未在对局中返回-1
- 参数列表:
- `(Player player)`
### `func containPlayer`
- 接口描述:查询某个玩家是否在对局中。
- 返回值:
- bool
- 参数列表:
- `(Player player)`