- 博客(27)
- 资源 (3)
- 问答 (1)
- 收藏
- 关注
原创 Leveldb源码解析第七篇【log】
版权声明:本文为博主原创文章,未经博主允许不得转载。这里的 log 非彼 log,这里的 log 是记录下用户的所有操作,防止设备异常导致 memtable 里面的数据丢失,用户在操作数据的时候首先会将操作写到 log 中,然后才会对数据进行操作 log相关的源码文件有db/log_format.hdb/log_reader.hdb/log_reader.ccdb/log_writer
2017-06-09 17:29:33
1015
原创 Leveldb源码解析第六篇【memtable】
版权声明:本文为博主原创文章,未经博主允许不得转载。数据在插入内存中的时候会在key前面和后面添加不同的表示,形成多种分类搞懂Memtable需要阅读如下源码db/MemTable.hdb/MemTable.ccdb/dbformat.hdb/dbformat.ccMemTable.hclass MemTable { public: // 构造方法,传入的是InternalKey类型的比
2017-06-09 17:28:18
994
原创 Leveldb源码解析第五篇【memtable之skiplist】
版权声明:本文为博主原创文章,未经博主允许不得转载。前面讲到了在 table 中插入数据,然后将数据持久化到磁盘中,这些都是一下底层的操作,用户真正写数据是放到内存中。本章就来介绍 key-value 在内存的操作skiplistkey-value 存放在在内存中采用的结构是 skiplist,结构如下所示head_------>7---------------------------------
2017-06-09 17:25:54
2115
原创 Leveldb源码解析第四篇【sstable添加key的流程】
版权声明:本文为博主原创文章,未经博主允许不得转载。添加一个key-value需要构造一个TableBuilder在构造TableBuilder时会构造一个Rep Rep里面有BlockBuilder类型的data_block和index_block,还有FilterBlockBuilder类型的filter_blockindex_block的重启点频率设置为1(默认是16)filter_b
2017-06-09 17:22:51
822
原创 Leveldb源码解析第三篇【sstable 收尾】
版权声明:本文为博主原创文章,未经博主允许不得转载。前面介绍完了table的data block和filter block,今天就来讲table收一下尾,table还剩meta index block,index block,footer这几个都比较简单,就一起介绍了table.h中是用来解析一个table的,在没搞懂table是什么东西前直接解析有点困难,而了解table最快速的办法就是看怎么t
2017-06-09 17:21:58
1066
1
原创 Leveldb源码解析第二篇【Meta Block】
版权声明:本文为博主原创文章,未经博主允许不得转载。上一章中详细讲解了 table 中的 data block 的结构以及涉及的源码,本章中将讲解 table 结构中的 meta blocktable 结构 <beginning_of_file> [data block 1] [data block 2] ... [data block N] [met
2017-06-09 17:20:54
2154
2
原创 Leveldb源码解析第一篇【Data Block】
版权声明:本文为博主原创文章,未经博主允许不得转载。leveldb 作为一个 key-value 数据库,它和 redis 的区别在于不仅没有把所有的数据放在内存中,而是把大部分数据放在了磁盘中leveldb 存数据的流程先指定一块内存写数据(这块内存称为 MemTable),当占用的内存高于阈值后,将这块内存转为只读(这块只读内存称为 Immutable MemTable)同时开辟一块新的内
2017-06-09 17:17:41
10622
6
原创 leetcode-Valid Palindrome
问题描述:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car"
2014-05-15 09:42:22
484
原创 leetcode-Validate Binary Search Tree
题目描述:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node
2014-05-11 23:16:56
492
原创 leetcode-Reverse Words in a String
问题描述:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".zhiqian
2014-05-05 16:52:14
521
原创 leetcode-Merge Sorted Array
问题描述:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional eleme
2014-05-05 10:40:09
358
原创 leetcode-Set Matrix Zeroes
问题描述:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution using O(mn) space is probabl
2014-05-05 09:02:43
415
原创 leetcode-Climbing Stairs
题目描述:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?做了半天,就是运行不起来,最后heng
2014-05-05 00:17:00
477
原创 leetcode-Valid Number
问题描述:Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to b
2014-05-04 22:02:26
672
原创 leetcode-Insert Interval
问题描述:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start
2014-05-04 20:50:47
481
原创 leetcode-Merge Intervals
描述:Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].找出公共区间
2014-05-04 19:05:36
505
原创 leetcode-Implement strStr()
问题描述:mplement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.实现strStr(
2014-05-04 15:26:41
430
原创 leetcode-Merge Two Sorted Lists
描述:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.将两个已经排序好的链表heb
2014-05-04 11:12:05
406
原创 leecode-Valid Parentheses
问题描述:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all v
2014-05-02 09:08:14
479
转载 页面调度算法
使用FIFO调度算法时,页面装入和调出的情况如下:页面号 7 0 1 2 3 0 4 3 2 3 6 7 3 1 5 7 6 2 6 7页面1 7 7 7 7 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 7页面2 0 0 0 0 0 4 4 4 4 4 4 4 4 5 5 5 5 5 5页面3 1 1 1 1 1 1 1 1 6 6 6 6
2014-04-10 23:33:46
1073
原创 qt做的一个动态实时监控项目
做了一个摄像头监控的项目环境:qtcreator-2.5.2+Qt4.7.3+MinGW+openCV2.1(装在c盘根目录下,在项目中引入的时候有用)功能介绍:监控笔记本摄像头,通过opencv的函数打开摄像头,用帧差分算法判断监控的区域有没有发生变化,也就是有没有物体进入监控区域,当监控的区域发生变化时,将这一帧发送给服务器端之前环境不允许,一直用一台电脑既当服务器又当客户端,挺成
2014-04-07 19:44:10
6720
数据库设计问题,在线等,求回答
2015-01-05
TA创建的收藏夹 TA关注的收藏夹
TA关注的人