diff options
Diffstat (limited to 'lurker/libesort/Transaction.h')
-rw-r--r-- | lurker/libesort/Transaction.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lurker/libesort/Transaction.h b/lurker/libesort/Transaction.h new file mode 100644 index 0000000..e34a872 --- /dev/null +++ b/lurker/libesort/Transaction.h @@ -0,0 +1,63 @@ +/* $Id: Transaction.h 1649 2009-10-19 14:35:01Z terpstra $ + * + * Transaction.h - Write buffer for a commit + * + * Copyright (C) 2002 - Wesley W. Terpstra + * + * License: GPL + * + * Authors: 'Wesley W. Terpstra' <wesley@terpstra.ca> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2.1. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRANSACTION_H +#define TRANSACTION_H + +namespace ESort +{ + +class Parameters; +class Transaction +{ + protected: + int fd; + const Parameters* p; + unsigned char* buf; + unsigned char* eof; + unsigned char* off; + + /** Dump the buffer. + */ + int dump(); + + public: + /** Write to this file descriptor. + * We do NOT assume responsibility for closing the file!! + */ + Transaction(int fd_, const Parameters* p_); + ~Transaction(); + + /** Output this to the file, 0 = success + */ + int write(long len, int dup, const char* key); + + /** Finalize the file, 0 = success + */ + int finish(); +}; + +} + +#endif |