Paster 服务端核心模块,使用字节跳动开源的微服务 RPC 框架 KiteX ,以 Apache Thrift 作为通信协议

Overview

paster_core

Paster 服务端核心模块,使用字节跳动开源的微服务 RPC 框架 KiteX ,以 Apache Thrift 作为通信协议。

Todo:

  • 实现 KiteX 服务注册扩展接口,使用 Consul 服务注册
  • 新增 frame 层,通过 PreProcessor, PostProcessor 优化 KiteX 框架请求处理日志
  • 利用 SQLite 生成 .db 文件,初始化 MySQL
  • 将项目打包成 Dokcer 镜像
  • ...

Sequence Diagram

namespace go ameidance.paster.core

enum LanguageType {
    PLAIN = 0
    CPP = 1
    JAVA = 2
    PYTHON = 3
    GO = 4
    MD = 5
}

struct PostInfo {
    1: required string Content
    2: required LanguageType Language
    3: required string Nickname
    4: required bool IsDisposable
    5: optional i64 CreateTime
}

struct CommentInfo {
    1: required string Content
    2: required string Nickname
    3: optional i64 CreateTime
}

struct GetPostRequest {
    1: required i64 Id
    2: optional string Password
}

struct GetPostResponse {
    1: optional PostInfo Info
    254: required i32 StatusCode
    255: required string StatusMessage
}

struct SavePostRequest {
    1: required PostInfo Info
    2: optional string Password
}

struct SavePostResponse {
    1: optional i64 Id
    254: required i32 StatusCode
    255: required string StatusMessage
}

struct DeletePostRequest {
    1: required i64 Id
}

struct DeletePostResponse {
    254: required i32 StatusCode
    255: required string StatusMessage
}

struct GetCommentsRequest {
    1: required i64 PostId
    2: optional string Password
}

struct GetCommentsResponse {
    1: optional list Info
    254: required i32 StatusCode
    255: required string StatusMessage
}

struct SaveCommentRequest {
    1: required CommentInfo Info
    2: required i64 PostId
    3: optional string Password
}

struct SaveCommentResponse {
    254: required i32 StatusCode
    255: required string StatusMessage
}

service PasterCoreService {
    GetPostResponse GetPost(1: GetPostRequest req)
    SavePostResponse SavePost(1: SavePostRequest req)
    DeletePostResponse DeletePost(1: DeletePostRequest req)
    GetCommentsResponse GetComments(1: GetCommentsRequest req)
    SaveCommentResponse SaveComment(1: SaveCommentRequest req)
}

ER Diagram

SET NAMES utf8mb4;
SET
FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment`
(
    `id`          bigint                                                       NOT NULL AUTO_INCREMENT COMMENT '评论自增 ID',
    `post_id`     bigint                                                       NOT NULL COMMENT '文本自增 ID',
    `content`     text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评论内容',
    `nickname`    varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评论人昵称',
    `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`id`),
    KEY           `idx_fk_post_id` (`post_id`),
    CONSTRAINT `idx_fk_post_id` FOREIGN KEY (`post_id`) REFERENCES `post` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Table structure for post
-- ----------------------------
DROP TABLE IF EXISTS `post`;
CREATE TABLE `post`
(
    `id`            bigint                                                       NOT NULL AUTO_INCREMENT COMMENT '文本自增 ID',
    `content`       text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文本内容',
    `lang`          smallint                                                     NOT NULL DEFAULT '0' COMMENT '文本语言',
    `passwd`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci         DEFAULT NULL COMMENT '密码',
    `nickname`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文本作者昵称',
    `is_disposable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否阅后即焚',
    `create_time`   timestamp NULL DEFAULT NULL COMMENT '创建时间',
    `update_time`   timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

SET
FOREIGN_KEY_CHECKS = 1;
Releases(v0.4-beta)
Go-to-thrift: a compiler that compiles golang file to thrift IDL

go-to-thrift Go-to-thrift is a compiler that compiles golang file to thrift IDL.

null 0 Dec 17, 2021
A native Thrift package for Go

Thrift Package for Go API Documentation: http://godoc.org/github.com/samuel/go-thrift License 3-clause BSD. See LICENSE file. Overview Thrift is an ID

Samuel Stauffer 372 May 25, 2022
A service registry and service discovery implemention for kitex based on etcd

kitex etcd Introduction kitexetcd is an implemention of service registry and service discovery for kitex based on etcd. Installation go get -u github.

null 4 Feb 18, 2022
Antenna RPC is an RPC protocol for distributed computing, it's based on QUIC and Colfer. its currently an WIP.

aRPC - Antenna Remote Procedure Call Antenna remote procedure call (aRPC) is an RPC protocol focused on distributed processing and HPC. aRPC is implem

Raphael de Carvalho Almeida 3 Jun 16, 2021
rpc/v2 support for JSON-RPC 2.0 Specification.

rpc rpc/v2 support for JSON-RPC 2.0 Specification. gorilla/rpc is a foundation for RPC over HTTP services, providing access to the exported methods of

High Performance, Kubernetes Native Object Storage 3 Jul 4, 2021
Go Substrate RPC Client (GSRPC)Go Substrate RPC Client (GSRPC)

Go Substrate RPC Client (GSRPC) Substrate RPC client in Go. It provides APIs and types around Polkadot and any Substrate-based chain RPC calls. This c

Chino Chang 1 Nov 11, 2021
Apache RocketMQ go client

RocketMQ Client Go A product ready RocketMQ Client in pure go, which supports almost the full features of Apache RocketMQ, such as pub and sub message

The Apache Software Foundation 914 Jun 21, 2022
Apache Traffic Control is an Open Source implementation of a Content Delivery Network

Apache Traffic Control Apache Traffic Control is an Open Source implementation of a Content Delivery Network. Documentation Intro CDN Basics Traffic C

The Apache Software Foundation 780 Jun 21, 2022
apache dubbo gateway,L7 proxy,virtual host,k8s ingress controller.

apache dubbo gateway,L7 proxy,virtual host,k8s ingress controller.

null 1 Nov 19, 2021
Message relay written in golang for PostgreSQL and Apache Kafka

Message Relay Message relay written in golang for PostgreSQL and Apache Kafka Requirements Docker and Docker Compose Local installation and using dock

null 0 Dec 19, 2021
Traefik plugin to proxy requests to owasp/modsecurity-crs:apache container

Traefik Modsecurity Plugin Traefik plugin to proxy requests to owasp/modsecurity-crs:apache Traefik Modsecurity Plugin Demo Full Configuration with do

Alexis Couvreur 40 Jun 19, 2022
CoreRAD is an extensible and observable IPv6 Neighbor Discovery Protocol router advertisement daemon. Apache 2.0 Licensed.

CoreRAD CoreRAD is an extensible and observable IPv6 Neighbor Discovery Protocol router advertisement daemon. Apache 2.0 Licensed. To get started with

Matt Layher 117 Jun 20, 2022
This project provides fully automated one-click experience to create Cloud and Kubernetes environment to run Data Analytics workload like Apache Spark.

Introduction This project provides a fully automated one-click tool to create Data Analytics platform in Cloud and Kubernetes environment: Single scri

DataPunch - One Click to Create Cloud and Kubernetes Environment for Data Analytics and Apache Spark 39 May 31, 2022
A protoc-gen-go wrapper including an RPC stub generator

// Copyright 2013 Google. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE fi

Kyle Lemons 36 Nov 5, 2021
Simple, fast and scalable golang rpc library for high load

gorpc Simple, fast and scalable golang RPC library for high load and microservices. Gorpc provides the following features useful for highly loaded pro

Aliaksandr Valialkin 651 Jun 20, 2022
A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.

Realtime API Gateway Synchronize Your Clients Visit Resgate.io for guides, live demos, and resources. Resgate is a Go project implementing a realtime

Resgate.io - Synchronize Your Clients 578 Jun 29, 2022
network multiplexing and framing protocol for RPC

TChannel Network multiplexing and framing protocol for RPC Read the Docs Languages: Node.js, Python, Go, Java Questions: Open a Github issue Uber's OS

Uber Open Source 1.2k Jun 15, 2022
The Go language implementation of gRPC. HTTP/2 based RPC

gRPC-Go The Go implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information

grpc 16.3k Jul 1, 2022
A simple RPC framework with protobuf service definitions

Twirp is a framework for service-to-service communication emphasizing simplicity and minimalism. It generates routing and serialization from API defin

Twitch 5.9k Jul 1, 2022