Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Remilia - Structure of Huaban Directional Pinni...
Search
ZHU, Kaidi
February 03, 2015
Programming
66
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Remilia - Structure of Huaban Directional Pinning System
ZHU, Kaidi
February 03, 2015
More Decks by ZHU, Kaidi
See All by ZHU, Kaidi
给 Node.js 插上 C++ 的翅膀
xadillax
1
170
Other Decks in Programming
See All in Programming
FDEが実現するAI駆動経営の現在地
gonta
2
260
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.2k
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
1.1k
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
580
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
670
仕様駆動開発の消費期限
watany
8
4.4k
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
440
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
830
数百円から始めるRuby電子工作
tarosay
0
130
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
210
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
370
Featured
See All Featured
Unsuck your backbone
ammeep
672
58k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Music & Morning Musume
bryan
47
7.3k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
670
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
BBQ
matthewcrist
89
10k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
610
Transcript
Remilia HDPS The Huaban Directional Pinning System
Subprojects The Cellar The Gate The Koumakan The API T
ester TODO…
Structure The Whole Koumakan’s Process
“All the gensokyo characters services are written in Framework Gensokyo.”
–XadillaX <The Remilia Bible> 1-1-3, Gensokyo Prologue
Gensokyo An Illyria RPC service framework written in Node.js http://gitlab.widget-inc.com/huaban/gensokyo
Installation $ npm install -g git+ssh://
[email protected]
:65422/huaban/gensokyo.git#<VERSION> Or … $ cnpm
install -g gensokyo [--registry=http://registry.npm.huaban.org]
$ gensokyo new cellar
module.exports = { echo1: [ "before1", "echo2" ], echo2: [
"before1", [ "echo1", "echo2" ], "after1" ], echo3: "echo1", echo4: { before: [ "before1" ], ctrller: "echo1" } };
function makeSequence(before, controller, after, routerName, keyName) { var sequence =
[]; sequence.add(before); sequence.add(controller); sequence.add(after); var func = function(req, resp, callback) { var funcIdx = 0; var funcCount = sequence.length; app.logger.info("Received a request \"{router}.{action}\".".assign({ router : routerName, action : keyName })); // do the sequence async.whilst( function() { return funcIdx < funcCount; }, function(next) { var func = sequence[funcIdx]; func(req, resp, function() { funcIdx++; next(); }); }, function(err) { if(err) { app.logger.err("An error occurred in `{router}` -> `{action}`: {error}".assign({ router : routerName, action : keyName, error : err.message })); return; } callback(); } ); }; return func; }
var util = require("util"); var Controller = require("gensokyo").Controller; var EchoController
= function(gensokyo) { Controller.call(this, gensokyo); }; util.inherits(EchoController, Controller); EchoController.prototype.echo1 = function(req, resp, next) { this.logger.info("echo1"); next(); }; EchoController.prototype.echo2 = function(req, resp, next) { this.logger.info("echo2"); resp.message.ok = true; // 测试⼈人品 if(Number.random(1, 100) < 50) { resp.error("You're unlucky!"); return; } next(); }; module.exports = EchoController;
“All ciphertext is from Sanae and into Cellar.” –Kochiya Sanae
<The Remilia Bible> 5-3-12, Sanae Ciphertext
The Cellar
The Cellar (Ver. 1) Fetch wet data from mongodb stored
by Sanae regularly Dry the wet data into useful data and store back to another collection
*#*# NO OFFLINE #*#*
The Cellar (Ver. 2) Wait for Illyria Requests. Get data
from Sanae’s storage. Response the data.
“Cellar is a raw data fetcher & sender. And the
Gate is to peep the raw data to fetch dry information.” –Remilia Scarlet <The Remilia Bible> 6-2-13, Gate T estament
“The Gate is a hub between the Cellar and the
Koumakan. And the peep hole is the core soul of the Gate.” –Remilia Scarlet <The Remilia Bible> 6-2-13, Gate T estament
Gate Wait for peep requests. Peep the raw data from
the Cellar. Response the peeped data back.
“One peep hole per rule. And one rule per hole.”
–Puppets <The Remilia Bible> 9-8-1, Puppet Oath
“We peep the image links, the site links.” –Puppets <The
Remilia Bible> 9-8-1, Puppet Oath
“Of cause, we peep the description of that heavenly image.
And we peep the kind of it.” –Puppets <The Remilia Bible> 9-8-1, Puppet Oath
“At last, don’t forget to peep the raw board name
for it.” –Puppets <The Remilia Bible> 9-8-1, Puppet Oath
“WE ARE ONLINE!” –Puppets <The Remilia Bible> 9-8-1, Puppet Oath
Cellar Sanae Storage Gate Peep Koumakan Puppet
Koumakan The palace puppets live. The magic controls all the
puppets. A puppet owns a Huaban account. Each puppet is independent.
“Remilia created a factory to create puppets at the first
day.” –<The Remilia Bible> 2-1-1, Factday
Puppet Manager The puppet factory var PuppetManager = function() {};
PuppetManager.prototype.addPuppets = function() {}; PuppetManager.prototype.startOne = function() {}; ……
“At the second day, she gave puppets body, blood and
soul.” –<The Remilia Bible> 2-1-2, Thouday
Puppet The pinning creature var Puppet = function() {}; Puppet.prototype.start
= function() {};
Puppets builds with Composition Account Composition Peeped Queue Composition Schedule
Composition (Pin) Hand Composition Board Composition …
Base Composition var BaseComposition = function(puppetId, parent) { EventEmitter.call(this); this.gensokyo
= gensokyo; this.logger = gensokyo.logger; this.puppetId = puppetId; this.parent = parent; }; util.inherits(BaseComposition, EventEmitter); module.exports = BaseComposition; BaseComposition.type = "BaseComposition";
Compositions var FooComposition = function(puppetId, parent) { BaseComposition.call(this, puppetId, parent);
}; util.inherts(FooComposition, BaseComposition); …
So Puppets var Puppet = function(puppetId) { EventEmitter.call(this); this.gensokyo =
gensokyo; this.logger = gensokyo.logger; this.puppetId = puppetId; // 账号组件 this.account = new Compositions.Account(puppetId, this); // 缓存数据队列 this.peepedQueue = new Compositions.PeepedQueue(puppetId, this); // 时间表 this.schedule = new Compositions.Schedule(puppetId, this); // ⼊入库之⽖爪 this.pinHand = new Compositions.PinHand(puppetId, this); // 魔貫光殺砲 ƅЧƅ)σ━00000000000━• … this.logger.info("Puppet " + puppetId + " created."); };
“Remilia endued puppets the ability to acquire an outside world,
Huaban at the third day.” –<The Remilia Bible> 2-1-3, Huaday
Account Composition var AccountComposition = function() {}; AccountComposition.prototype.fetchInformation = function()
{}; AccountComposition.prototype.createAccount = function() {}; AccountComposition.prototype.signIn = function() {}; …
“Give me name and avatar!” –Puppets <The Remilia Bible> 2-1-3,
Huaday
The Other Sides of the World http://www.qzone.cc/ http://bbs.duowan.com/ Waiting for
you, my new God of creation…
“Puppets got the ability of peeping from Gate at the
forth day due to Remilia.” –<The Remilia Bible> 2-1-4, Gatday
Peeped Queue Composition var PeepedQueueComposition = function() {}; PeepedQueueComposition.prototype.nextImage =
function() {}; PeepedQueueComposition.prototype.clean = function() {}; PeepedQueueComposition.prototype.peepCrowd = function() {}; ...
“Fifth day, Remilia gave puppets the ability to create Boards.”
–<The Remilia Bible> 2-1-5, Boarday
Board Composition var BoardComposition = function() {}; BoardComposition.prototype.getBoard = function()
{}; BoardComposition.randomStyleName = function() {}; ...
“Sixth day, puppets got the ability to pin to Huaban
from Remilia.” –<The Remilia Bible> 2-1-6, Pinsday
Pin Hand Composition var PinHandComposition = function() {}; PinHandComposition.prototype.pin =
function() {}; ...
“The last day, each puppet made its own schedule to
pin. And Remilia went to rest.” –<The Remilia Bible> 2-1-7, Scheday
Schedule Composition var ScheduleComposition = function() {}; ScheduleComposition.prototype.genSchedule = function()
{}; ScheduleComposition.prototype.nextCanAndCant = function() {}; ...
“Let me be like a human!” –Puppets <The Remilia Bible>
2-1-7, Huaday
Sleep… Rest… Pin… Rest… Pin… … Sleep…
“Boom is a Bang to implement interacting with Huaban.” –Remilia
Scarlet <The Remilia Bible> 17-3-8, Big Boom
Boom Used by others (Celler, Gate or Koumakan)
“We need a centre control magic!” –Remilia Scarlet <The Remilia
Bible> 21-7-14, Residual Page XIV
Fin The world’s ending is another world’s beginning.