Coder Social home page Coder Social logo

bigdataprojects's Introduction

项目1:粉丝系统小demo

  • 目的:用来练习HBase的业务操作所用,无前端,为后端自测

需求分析

  • 用户编写内容的浏览,数据库表设计

  • 可以将索引等信息存在mysql,数据存在Hbase

  • 用户社交体现:关注用户,取关用户

  • 拉取关注的人的内容

HBase表

内容表

方法 creatTableeContent
Table Name fanssystem:content
RowKey 用户ID_时间戳
ColumnFamily info
ColumnLabel 内容
Version 1个版本

用户关系表

方法 createTableRelations
Table Name fanssystem:relations
RowKey 用户ID
ColumnFamily attends、fans
ColumnLabel 关注用户ID,粉丝用户ID
ColumnValue 用户ID
Version 1个版本

用户内容接收邮件表

方法 createTableReceiveContentEmails
Table Name fanssystem:receive_content_email
RowKey 用户ID
ColumnFamily info
ColumnLabel 用户ID
ColumnValue 取内容的RowKey
Version 1000

业务流程解析

发布内容

1.内容表中添加1条数据

2.收件箱表对所有粉丝用户添加数据

关注用户

1.在用户关系表中,对当前主动操作的用户添加新关注的好友

2.在用户关系表中,对被关注的用户添加新的粉丝

3.收件箱表中添加所关注的用户发布的内容

取关用户

1.在用户关系表中,对当前主动操作的用户移除取关的好友(attends)

2.在用户关系表中,对被取关的用户移除粉丝

3.收件箱中删除取关的用户发布的内容

获取关注的人的内容

1.从收件箱中获取所关注的用户的内容RowKey

2.根据获取的RowKey,得到内容

类简介

Bootstrap为启动类,内包含一些测试用例;

Constant定义常量;

HConnectionUtil定义HConnection的操作;

FansSystem为驱动类,初始化命名空间及表;

SystemService为四个业务的代码;

Context为内容表;

Relations为用户关系表;

ReceiveContentEmail为用户内容接收邮件表;

Message为内容详情表;

NameSpace为命名空间,类似数据库的schema。

bigdataprojects's People

Contributors

cyxpdc avatar

Stargazers

 avatar

Forkers

kongdz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.