Loading CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,8 @@ The format is based on [keep a changelog](http://keepachangelog.com/) and this p ### Changed - The build system now strips up to current dir in recorded source file paths at compile. - Addition of specific error messages to the Error payload. - Group names must be unique. ### Fixed - Fix regression loading config file. Loading migrations/20170115200001_initial_schema.sql +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS users ( PRIMARY KEY (id), id BYTEA NOT NULL, handle VARCHAR(20) UNIQUE NOT NULL, handle VARCHAR(20) CONSTRAINT users_handle_key UNIQUE NOT NULL, fullname VARCHAR(70), avatar_url VARCHAR(255), -- https://tools.ietf.org/html/bcp47 Loading Loading @@ -77,7 +77,7 @@ CREATE TABLE IF NOT EXISTS groups ( PRIMARY KEY (id), id BYTEA NOT NULL, creator_id BYTEA NOT NULL, name VARCHAR(70) NOT NULL, name VARCHAR(70) CONSTRAINT groups_name_key UNIQUE NOT NULL, description VARCHAR(255), avatar_url VARCHAR(255), -- https://tools.ietf.org/html/bcp47 Loading migrations/20170228205100_leaderboards.sql +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ CREATE TABLE IF NOT EXISTS leaderboard_record ( ranked_at INT CHECK (ranked_at >= 0) DEFAULT 0 NOT NULL, updated_at INT CHECK (updated_at > 0) NOT NULL, -- Used to enable proper order in revscan when sorting by score descending. -- Revscan is unaviodable here due to cockroachdb/cockroach#14241. updated_at_inverse INT CHECK (updated_at > 0) NOT NULL, expires_at INT CHECK (expires_at >= 0) DEFAULT 0 NOT NULL, banned_at INT CHECK (expires_at >= 0) DEFAULT 0 NOT NULL Loading server/api.proto +20 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,23 @@ message Heartbeat { } message Error { string reason = 1; enum Code { RUNTIME_EXCEPTION = 0; UNRECOGNIZED_PAYLOAD = 1; MISSING_PAYLOAD = 2; BAD_INPUT = 3; AUTH_ERROR = 4; USER_LINK_INUSE = 5; USER_LINK_PROVIDER_UNAVAILABLE = 6; USER_UNLINK_DISALLOWED = 7; USER_HANDLE_INUSE = 8; GROUP_NAME_INUSE = 9; STORAGE_FETCH_DISALLOWED = 10; MATCH_NOT_FOUND = 11; } int32 code = 1; string message = 2; } message AuthenticateRequest { Loading Loading @@ -58,8 +74,9 @@ message AuthenticateResponse { } message Error { string reason = 1; AuthenticateRequest request = 2; int32 code = 1; string message = 2; AuthenticateRequest request = 3; } string collation_id = 1; Loading server/pipeline.go +19 −2 Original line number Diff line number Diff line Loading @@ -134,8 +134,25 @@ func (p *pipeline) processRequest(logger zap.Logger, session *session, envelope p.leaderboardRecordsList(logger, session, envelope) case nil: session.Send(&Envelope{CollationId: envelope.CollationId, Payload: &Envelope_Error{&Error{Reason: "No payload found"}}}) session.Send(ErrorMessage(envelope.CollationId, MISSING_PAYLOAD, "No payload found")) default: session.Send(&Envelope{CollationId: envelope.CollationId, Payload: &Envelope_Error{&Error{Reason: "Unrecognized payload"}}}) session.Send(ErrorMessage(envelope.CollationId, UNRECOGNIZED_PAYLOAD, "Unrecognized payload")) } } func ErrorMessageRuntimeException(collationID string, message string) *Envelope { return ErrorMessage(collationID, RUNTIME_EXCEPTION, message) } func ErrorMessageBadInput(collationID string, message string) *Envelope { return ErrorMessage(collationID, BAD_INPUT, message) } func ErrorMessage(collationID string, code Error_Code, message string) *Envelope { return &Envelope{ CollationId: collationID, Payload: &Envelope_Error{&Error{ Message: message, Code: int32(code), }}} } Loading
CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,8 @@ The format is based on [keep a changelog](http://keepachangelog.com/) and this p ### Changed - The build system now strips up to current dir in recorded source file paths at compile. - Addition of specific error messages to the Error payload. - Group names must be unique. ### Fixed - Fix regression loading config file. Loading
migrations/20170115200001_initial_schema.sql +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS users ( PRIMARY KEY (id), id BYTEA NOT NULL, handle VARCHAR(20) UNIQUE NOT NULL, handle VARCHAR(20) CONSTRAINT users_handle_key UNIQUE NOT NULL, fullname VARCHAR(70), avatar_url VARCHAR(255), -- https://tools.ietf.org/html/bcp47 Loading Loading @@ -77,7 +77,7 @@ CREATE TABLE IF NOT EXISTS groups ( PRIMARY KEY (id), id BYTEA NOT NULL, creator_id BYTEA NOT NULL, name VARCHAR(70) NOT NULL, name VARCHAR(70) CONSTRAINT groups_name_key UNIQUE NOT NULL, description VARCHAR(255), avatar_url VARCHAR(255), -- https://tools.ietf.org/html/bcp47 Loading
migrations/20170228205100_leaderboards.sql +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ CREATE TABLE IF NOT EXISTS leaderboard_record ( ranked_at INT CHECK (ranked_at >= 0) DEFAULT 0 NOT NULL, updated_at INT CHECK (updated_at > 0) NOT NULL, -- Used to enable proper order in revscan when sorting by score descending. -- Revscan is unaviodable here due to cockroachdb/cockroach#14241. updated_at_inverse INT CHECK (updated_at > 0) NOT NULL, expires_at INT CHECK (expires_at >= 0) DEFAULT 0 NOT NULL, banned_at INT CHECK (expires_at >= 0) DEFAULT 0 NOT NULL Loading
server/api.proto +20 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,23 @@ message Heartbeat { } message Error { string reason = 1; enum Code { RUNTIME_EXCEPTION = 0; UNRECOGNIZED_PAYLOAD = 1; MISSING_PAYLOAD = 2; BAD_INPUT = 3; AUTH_ERROR = 4; USER_LINK_INUSE = 5; USER_LINK_PROVIDER_UNAVAILABLE = 6; USER_UNLINK_DISALLOWED = 7; USER_HANDLE_INUSE = 8; GROUP_NAME_INUSE = 9; STORAGE_FETCH_DISALLOWED = 10; MATCH_NOT_FOUND = 11; } int32 code = 1; string message = 2; } message AuthenticateRequest { Loading Loading @@ -58,8 +74,9 @@ message AuthenticateResponse { } message Error { string reason = 1; AuthenticateRequest request = 2; int32 code = 1; string message = 2; AuthenticateRequest request = 3; } string collation_id = 1; Loading
server/pipeline.go +19 −2 Original line number Diff line number Diff line Loading @@ -134,8 +134,25 @@ func (p *pipeline) processRequest(logger zap.Logger, session *session, envelope p.leaderboardRecordsList(logger, session, envelope) case nil: session.Send(&Envelope{CollationId: envelope.CollationId, Payload: &Envelope_Error{&Error{Reason: "No payload found"}}}) session.Send(ErrorMessage(envelope.CollationId, MISSING_PAYLOAD, "No payload found")) default: session.Send(&Envelope{CollationId: envelope.CollationId, Payload: &Envelope_Error{&Error{Reason: "Unrecognized payload"}}}) session.Send(ErrorMessage(envelope.CollationId, UNRECOGNIZED_PAYLOAD, "Unrecognized payload")) } } func ErrorMessageRuntimeException(collationID string, message string) *Envelope { return ErrorMessage(collationID, RUNTIME_EXCEPTION, message) } func ErrorMessageBadInput(collationID string, message string) *Envelope { return ErrorMessage(collationID, BAD_INPUT, message) } func ErrorMessage(collationID string, code Error_Code, message string) *Envelope { return &Envelope{ CollationId: collationID, Payload: &Envelope_Error{&Error{ Message: message, Code: int32(code), }}} }