]>
git.proxmox.com Git - ceph.git/blob - ceph/src/os/filestore/Journal.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
16 #ifndef CEPH_JOURNAL_H
17 #define CEPH_JOURNAL_H
21 #include "include/buffer_fwd.h"
22 #include "include/Context.h"
23 #include "common/Finisher.h"
24 #include "common/TrackedOp.h"
25 #include "os/ObjectStore.h"
26 #include "common/zipkin_trace.h"
42 Journal(CephContext
* cct
, uuid_d f
, Finisher
*fin
, Cond
*c
=0) :
43 fsid(f
), finisher(fin
), cct(cct
), logger(NULL
),
45 wait_on_full(false) { }
46 virtual ~Journal() { }
48 virtual int check() = 0; ///< check if journal appears valid
49 virtual int create() = 0; ///< create a fresh journal
50 virtual int open(uint64_t fs_op_seq
) = 0; ///< open an existing journal
51 virtual void close() = 0; ///< close an open journal
53 virtual void flush() = 0;
56 * reserve_throttle_and_backoff
58 * Implementation may throttle or backoff based on ops
59 * reserved here but not yet released using committed_thru.
61 virtual void reserve_throttle_and_backoff(uint64_t count
) = 0;
63 virtual int dump(ostream
& out
) { return -EOPNOTSUPP
; }
65 void set_wait_on_full(bool b
) { wait_on_full
= b
; }
68 virtual bool is_writeable() = 0;
69 virtual int make_writeable() = 0;
70 virtual void submit_entry(uint64_t seq
, bufferlist
& e
, uint32_t orig_len
,
72 TrackedOpRef osd_op
= TrackedOpRef()) = 0;
73 virtual void commit_start(uint64_t seq
) = 0;
74 virtual void committed_thru(uint64_t seq
) = 0;
76 /// Read next journal entry - asserts on invalid journal
77 virtual bool read_entry(
78 bufferlist
&bl
, ///< [out] payload on successful read
79 uint64_t &seq
///< [in,out] sequence number on last successful read
80 ) = 0; ///< @return true on successful read, false on journal end
82 virtual bool should_commit_now() = 0;
84 virtual int prepare_entry(vector
<ObjectStore::Transaction
>& tls
, bufferlist
* tbl
) = 0;
86 virtual off64_t
get_journal_size_estimate() { return 0; }