
文件操作
binling
这个作者很懒,什么都没留下…
展开
-
BigQueue:The Architecture and Design of a Publish & Subscribe Messaging System Tailored for Big Data
The Architecture and Design of a Publish & Subscribe Messaging System Tailored for Big Data Collecting and AnalyticsMAR 27TH, 2013 | COMMENTSOverviewWith the advent of big data era, we a转载 2016-03-18 15:45:13 · 3436 阅读 · 0 评论 -
文件操作总结
seek 到一个大于文件length的值写:产生hole, size 包含hole的部分,size on disk只包含实际字节。seek到文件中间:覆盖,类似编辑模式中的覆盖,而不是insert,没有覆盖到的还是原来的内容,原创 2016-03-14 18:18:17 · 369 阅读 · 0 评论 -
队列实现的一些问题(scalable, persistent)
Persistent Queue的实现方式:1)Berkeley DB,一个基于文件的高效的key-value store。需要一个从key-value 存取系统到 FIFO存取系统的转换。维护一个自增的Long型的key,队头就是最小的key,队尾就是最大的key。2)paged file。队列由一系列文件或者块组成,只有第一个块和最后一个块是hot的,需要map到memory里原创 2016-03-14 17:42:49 · 541 阅读 · 0 评论 -
C++,java,python一行一行读文件的模版
Python:with open('filename') as f: for line in f.readlines(): # process the lineC++:ifstream f("filename");string line;while (getline(f, line) { // process the line}Java:BufferedR原创 2015-09-29 22:03:36 · 462 阅读 · 0 评论 -
BigArray算法核心
几个Object: logical array, paged index files, data filesLogical Array: 1) head index: next array index to append2) tail index: start index of the array, typically 0, if not wrapped这两个是logica原创 2016-03-21 17:23:23 · 580 阅读 · 0 评论 -
文件系统知识点
1 堆文件类似数据库的堆表,内存管理中的堆,记录是无序存储的,要访问一个记录需要知道其地址(位移),mds的masterBin就是这种文件,自己维护metadata(pointer table)2散列文件记录按照key散列到块, hash(key) % n,n是总块数。然后存入块里,如果块满了,就插入到溢出桶(拉链法)缺点,只能根据key来取一条记录(bookmark查询)原创 2015-09-10 13:08:50 · 586 阅读 · 0 评论 -
自己动手写一个key value store
一涉及到persistent, 哪怕只是最基本的需求,很多人都会依赖数据库,或是其他现成的库或工具。确实,对于文件,大部分人很少直接打交道,或者只是诸如整体反序列化/序列化、按行读取、append new line等有限的操作。一个persistent store最基本的问题是如何组织数据,也就是access method, 大致有:1)队列(定长记录 or 不定长记录): kaf原创 2016-10-10 18:08:41 · 1533 阅读 · 0 评论 -
顺序读写文件的实验
一个OutputStream不断append文件,一个InputStream读同一个文件,读的速度比写快。当Reader 赶上Writer的时候会EOF,但不存在data corruption问题,不需要用户同步。理论上也应该是这样:文件是按块存取的1)如果读写不在一个块,挨不着2)在一个块,变成了一个内存块的顺序读和顺序写的问题,也不需要同步内存块顺序读和顺序写的scen原创 2016-04-06 16:53:07 · 1590 阅读 · 0 评论