• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

evolvedbinary / elemental / 982

29 Apr 2025 08:34PM UTC coverage: 56.409% (+0.007%) from 56.402%
982

push

circleci

adamretter
[feature] Improve README.md badges

28451 of 55847 branches covered (50.94%)

Branch coverage included in aggregate %.

77468 of 131924 relevant lines covered (58.72%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.77
/exist-core/src/main/java/org/exist/storage/blob/BlobStoreImplService.java
1
/*
2
 * Elemental
3
 * Copyright (C) 2024, Evolved Binary Ltd
4
 *
5
 * admin@evolvedbinary.com
6
 * https://www.evolvedbinary.com | https://www.elemental.xyz
7
 *
8
 * Use of this software is governed by the Business Source License 1.1
9
 * included in the LICENSE file and at www.mariadb.com/bsl11.
10
 *
11
 * Change Date: 2028-04-27
12
 *
13
 * On the date above, in accordance with the Business Source License, use
14
 * of this software will be governed by the Apache License, Version 2.0.
15
 *
16
 * Additional Use Grant: Production use of the Licensed Work for a permitted
17
 * purpose. A Permitted Purpose is any purpose other than a Competing Use.
18
 * A Competing Use means making the Software available to others in a commercial
19
 * product or service that: substitutes for the Software; substitutes for any
20
 * other product or service we offer using the Software that exists as of the
21
 * date we make the Software available; or offers the same or substantially
22
 * similar functionality as the Software.
23
 */
24
package org.exist.storage.blob;
25

26
import org.apache.logging.log4j.LogManager;
27
import org.apache.logging.log4j.Logger;
28
import org.exist.storage.BrokerPool;
29
import org.exist.storage.BrokerPoolService;
30
import org.exist.storage.BrokerPoolServiceException;
31
import org.exist.storage.DBBroker;
32
import org.exist.storage.txn.Txn;
33
import org.exist.util.Configuration;
34
import org.exist.util.crypto.digest.DigestType;
35

36
import javax.annotation.Nullable;
37
import java.io.IOException;
38
import java.nio.file.Path;
39

40
/**
41
 * Broker Pool Service for the de-duplicating
42
 * Blob Store, see {@link BlobStoreImpl}.
43
 *
44
 * @author <a href="mailto:adam@evolvedbinary.com">Adam Retter</a>
45
 */
46
public class BlobStoreImplService implements BlobStoreService, BrokerPoolService {
1✔
47

48
    private static final Logger LOG = LogManager.getLogger(BlobStoreImplService.class);
1✔
49

50
    private static final String BLOB_STORE_PERSISTENT_FILE_NAME = "blob.dbx";
51
    private static final String BLOB_STORE_DIR_NAME = "blob";
1✔
52

53
    private Path persistentFile;
54
    private Path dataDir;
55
    private Path blobDir;
56
    private BlobStore blobStore;
57

58
    @Override
59
    public void configure(final Configuration configuration) throws BrokerPoolServiceException {
60
        this.dataDir = (Path)configuration.getProperty(BrokerPool.PROPERTY_DATA_DIR);
1✔
61
        if (dataDir == null) {
1!
62
            throw new BrokerPoolServiceException("Could not determine " + BrokerPool.PROPERTY_DATA_DIR + " from the configuration");
×
63
        }
64

65
        this.persistentFile = dataDir.resolve(BLOB_STORE_PERSISTENT_FILE_NAME);
1✔
66
        this.blobDir = dataDir.resolve(BLOB_STORE_DIR_NAME);
1✔
67
    }
1✔
68

69
    @Override
70
    public void prepare(final BrokerPool pool) {
71
        this.blobStore = new BlobStoreImpl(pool, persistentFile, blobDir, DigestType.BLAKE_256);
1✔
72
    }
1✔
73

74
    @Override
75
    public void startSystem(final DBBroker systemBroker, final Txn transaction) throws BrokerPoolServiceException {
76
        try {
77
            this.blobStore.open();
1✔
78
            LOG.info("Opened de-duplicating Blob Store v" + BlobStoreImpl.BLOB_STORE_VERSION + ". metadata={}, store={}/", dataDir.relativize(persistentFile), dataDir.relativize(blobDir));
1✔
79
        } catch (final IOException e) {
1✔
80
            throw new BrokerPoolServiceException(e);
×
81
        }
82
    }
1✔
83

84
    @Override
85
    public void shutdown() {
86
        if (this.blobStore != null) {
1!
87
            try {
88
                this.blobStore.close();
1✔
89
            } catch (final IOException e) {
1✔
90
                LOG.error("Clean shutdown of Blob Store failed: {}", e.getMessage(), e);
×
91
            }
92
        }
93
    }
1✔
94

95
    @Override
96
    @Nullable public BlobStore getBlobStore() {
97
        return blobStore;
1✔
98
    }
99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc