跳到主要内容

bloom.server

简介

组件接口

FEntityProfile.gs

基于心跳机制实现的资料同步组件(发布订阅模式) 做为发布者

做为订阅者

重要!!!

函数原型函数作用
void add_publish_profile_type(string profile_type, function profile_gen_func)添加发布类型
void remove_publish_profile_type(string profile_type)移除发布类型
void remove_all_publish_profile_types()移除所有发布类型
void set_publish_profile_dirty(string profile_type)标记资料需要发布
void publish_profile(string profile_type, bool force_publish = false)发布指定类型的资料
void publish_all_profiles()发布所有资料
mixed get_publish_profile(string profile_type)提供给订阅者获取指定类型的资料
void subscribe_profile(string profile_type, object publish_ob, function func)订阅指定类型的资料
void unsubscribe_profile(string profile_type)取消已订阅的指定类型的资料
void unsubscribe_all_profiles()取消所有已订阅的资料
mixed get_subscribe_profile(string profile_type)订阅者获取订阅的资料

net.gs

函数原型函数作用
object start_server(string name, int port, bool ws, int client_heart = 0, array cmd_dirs = nil)启动服务器
void stop_server(string name)关闭服务器
void stop_all_servers()关闭所有服务器
object get_server(string name)通过名称获取服务器对象
void on_server_start(string name, function func)响应指定名称的服务器启动回调函数
void on_server_stop(string name, function func)响应指定名称的服务器停止回调函数

CircularQueue

循环队列,用来处理固定大小的缓冲区

成员变量

变量名类型初始值须初始化描述
listarraynil可选
headint0可选
tailint0可选
sizeint0可选

成员方法

函数原型函数作用
bool is_queue_full()判断队列是否满
bool is_queue_empty()判断队列是否为空
int get_queue_size()获取队列大小
bool enqueue(mixed value)入队
mixed dequeue()出队
array dequeue_n(int count)出队n个
void drop_n(int count)丢弃n个
mixed peek(int offset = 0)获取队列头部元素(不删除)
void resize(int size)调整队列大小
int next_index(int n, int size)