]>
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/common_fwd.h"
23 #include "include/Context.h"
24 #include "common/Finisher.h"
25 #include "common/TrackedOp.h"
26 #include "os/ObjectStore.h"
27 #include "common/zipkin_trace.h"
38 ceph::condition_variable
*do_sync_cond
;
42 Journal(CephContext
* cct
, uuid_d f
, Finisher
*fin
, ceph::condition_variable
*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;
55 virtual void get_devices(std::set
<std::string
> *ls
) {}
56 virtual void collect_metadata(std::map
<std::string
,std::string
> *pm
) {}
58 * reserve_throttle_and_backoff
60 * Implementation may throttle or backoff based on ops
61 * reserved here but not yet released using committed_thru.
63 virtual void reserve_throttle_and_backoff(uint64_t count
) = 0;
65 virtual int dump(std::ostream
& out
) { return -EOPNOTSUPP
; }
67 void set_wait_on_full(bool b
) { wait_on_full
= b
; }
70 virtual bool is_writeable() = 0;
71 virtual int make_writeable() = 0;
72 virtual void submit_entry(uint64_t seq
, ceph::buffer::list
& e
, uint32_t orig_len
,
74 TrackedOpRef osd_op
= TrackedOpRef()) = 0;
75 virtual void commit_start(uint64_t seq
) = 0;
76 virtual void committed_thru(uint64_t seq
) = 0;
78 /// Read next journal entry - asserts on invalid journal
79 virtual bool read_entry(
80 ceph::buffer::list
&bl
, ///< [out] payload on successful read
81 uint64_t &seq
///< [in,out] sequence number on last successful read
82 ) = 0; ///< @return true on successful read, false on journal end
84 virtual bool should_commit_now() = 0;
86 virtual int prepare_entry(std::vector
<ObjectStore::Transaction
>& tls
, ceph::buffer::list
* tbl
) = 0;
88 virtual off64_t
get_journal_size_estimate() { return 0; }