hadoop core fs包源碼概要分析(hadoop 0.20.2 cdh3u3)

UHP博客文章地址:http://yuntai.1kapp.com/?p=440

原創文章,轉載請註明出處:http://blog.csdn.net/wind5shy/article/details/8090130

fs

BlockLocation

包含block長度,所在datanode列表和block在file中的offset信息。

BufferedFSInputStream

通過緩存優化FSInputStream讀取。

ChecksumFileSystem

抽象的校驗和文件系統,爲每個裸文件創建一個校驗和文件,在客戶端生成和驗證校驗和。

CommonConfigurationKeys

包含common中使用配置屬性key。

ContentSummary

目錄或文件概要信息(長度、目錄/文件數目、配額、已使用空間等)。

DF

文件系統磁盤空間用量統計shell。使用linux df命令獲取mount點和java.io.File作爲空間工具。

DU

文件系統磁盤空間用量統計shell。使用linux du命令獲取mount點和java.io.File作爲空間工具。

FileChecksum

表示文件校驗和的抽象類。

FileStatus

文件的客戶端信息(路徑、長度、塊、修改/訪問時間、權限、用戶等)抽象類。

FileSystem

文件系統抽象類。fs包含一個指示的唯一url、配置和用戶。

·          管理創建fs實例。

·          包含一個靜態fs cache,以 url、創建時分配唯一的long id和UserGroupInformation爲key。

·          對fs中文件/目錄的操作由實現類實現。

FileUtil

文件處理工具類。

FilterFileSystem

fs的代理類,內部封裝一個fs。所有繼承自fs的方法均由封裝的方式實現。

FSDataInputStream

extends DataInputStream implementsSeekable, PositionedReadable,封裝一個實現Seekable和PositionedReadable的InputStream,相關方法均由這個InputStream實現。

FSDataOutputStream

extends DataOutputStream implementsSyncable,內部類PositionCache(extends FilterOutputStream)包含一個FileSystem.Statistics引用(便於對寫入數據進行統計)和記錄流position的long。

FSInputChecker

extends FSInputStream,通過校驗和驗證輸入流讀取是否正確的抽象類。

FSInputStream

extends InputStream implements Seekable,PositionedReadable,有按位置讀取功能的輸入流抽象類。

FSOutputSummer

extends OutputStream,生成寫出數據的校驗和的抽象類。

FsShell

提供fs命令。

FsShellPermissions

提供文件權限相關命令。

FsStatus

表示fs容量信息。

FsUrlConnection

fs連接,通過連接來獲取fs的輸入流。

FsUrlStreamHandler

extends URLStreamHandler,處理fs url的類,和fs配置相關。

FsUrlStreamHandlerFactory

FsUrlStreamHandler工廠類。

GlobExpander

將正則表達式表示的文件路徑pattern分隔爲子一級的pattern,參見TestGlobExpander。

HarFileSystem

用來進行歸檔的fs。

/**

 * This is an implementation of the HadoopArchive

 * Filesystem. This archive Filesystemhas index files

 * of the form _index* and has contents of theform

 * part-*. The index files store the indexes of the

 * real files. The index files are of the form_masterindex

 * and _index. The master index is a level ofindirection

 * in to the index file to make the look upsfaster. the index

 * file is sorted with hash code of the paths thatit contains

 *and the master index contains pointers to thepositions in

 * index for ranges of hashcodes.

 */


LocalDirAllocator

通過輪叫(RoundRobin)爲創建文件分配磁盤。根據請求的空間大小,依次從待選磁盤中選擇有足夠空間的磁盤進行分配。

此實現中磁盤實際上爲配置中的目錄;提供每個JVM可以使用多個allocator的功能;但沒有考慮磁盤只讀和在寫入文件時空間用完的情況(磁盤被多處理共享)。

LocalFileSystem

本地fs。

MD5MD5CRC32FileChecksum

使用md5和crc32的校驗和。

Path

文件/目錄在fs中的路徑。

PathFilter

路徑過濾器接口。

PositionedReadable

可指定位置讀接口。

RawLocalFileSystem

裸本地 fs。

Seekable

提供按位置查找功能的接口。

Syncable

提供同步緩存功能的接口。

Trash

回收站。

將刪除的文件移動到用戶的回收站目錄(用戶home目錄下的.Trash子目錄,移動都是通過通過rename實現)。文件首先被移動到.Trash目錄的current目錄中。回收站會定期checkpoint,checkpoint時將current目錄中的文件移動到帶checkpoint時間目錄中,同時將超過一定期限的checkpoint目錄刪除。Emptier線程定期執行checkpoint.

 

ftp

FTPFileSystem

ftp fs,後臺由apache ftp client實現,也就是對一個apacheftp進行了fs包裝。

FTPInputStream

處理ftp fs的FSInputStream。

kfs

IFSImpl

Kfs適配操作接口。

KFSImpl

Kfs適配操作實現,內部封裝一個KfsAccess,將KfsAccess操作和實現fs所需操作進行適配。

KFSInputStream

處理kfs的FSInputStream,內部封裝一個KfsInputChannel,內部對KfsInputChannel操作和FSInputStream所需操作進行適配。

KFSOutputStream

處理kfs的OutputStream,內部封裝一個KfsInputChannel,內部對KfsInputChannel操作和OutputStream所需操作進行適配。

KosmosFileSystem

通過kfs實現的fs,內部封裝一個IFSImpl來實現fs相關操作。

permission

ChmodParser

處理chmod命令的分析器。

FsAction

處理讀/寫/執行action的枚舉類。

FsPermission

處理文件/目錄權限。

PermissionParser

處理文件/目錄權限的分析器,子類有ChmodParser和UmaskParser。

PermissionStatus

權限狀態,包括用戶名,組名和FsPermission。

UmaskParser

處理umask命令的分析器。

s3

和s3native區別在於是基於塊的,而後者是基於文件,文件大小限制爲5G。

Block

block元數據,id和length。

FileSystemStore

存儲和檢索block和node的設施接口。

INode

文件元數據,包括類型(文件/目錄)和相關block,不包括文件path。path由FileSystemStore處理後通過S3Service保存。

Jets3tFileSystemStore

FileSystemStore實現類,對應s3中的一個bucket。

內部封裝一個S3Service和一個S3Bucket,通過S3Service操縱S3Bucket實現接口相關操作。

MigrationTool

將數據從舊版本s3 fs遷移到新版本fs的工具。遷移通過重寫block元數據實現,不會影響到數據。

S3Credentials

從fs uri或配置中提取AWS證書。

S3FileSystem

s3 fs,內部封裝一個FileSystemStore實現相關操作。

S3InputStream

s3 fs的FSInputStream,對應一個INode(文件)。

S3OutputStream

s3 fs的OutputStream,對應一個INode(文件)。

 

s3native

FileMetadata

存儲在NativeFileSystemStore中的文件元數據,包括key(path),長度和最後修改時間。

Jets3tNativeFileSystemStore

NativeFileSystemStore實現類,實現同Jets3tFileSystemStore類似。

NativeFileSystemStore

基於key對文件進行管理的接口。

NativeS3FileSystem

s3native fs,實現同S3FileSystem類似。

PartialListing

包含以指定前綴(一般就是目錄名)下所有FileMetadata信息。

 

shell

Command

fs命令抽象類。

CommandFormat

分析命令參數,驗證參數格式。

CommandUtils

目前只有格式化count命令描述的工具方法。

Count

Count the number of directories, files,bytes, quota, and remaining quota.

fs count命令處理。

原創文章,轉載請註明出處:http://blog.csdn.net/wind5shy/article/details/8090130


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章